Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Video conference #237

Merged
merged 6 commits into from
Mar 18, 2019
Merged

[NEW] Video conference #237

merged 6 commits into from
Mar 18, 2019

Conversation

philipbrito
Copy link
Contributor

Add support for video call into the SDK. Also updates dependencies version (coroutines is no more experimental!)

@philipbrito philipbrito self-assigned this Mar 12, 2019

logger.debug { "running ping if active" }
logger.debug { "Running ping if active" }
if (!isActive) return@launch

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary since pings are suspension functions


logger.debug { "Scheduling ping timeout in $timeout milliseconds" }
timeoutJob = launch(parentJob) {
delay(timeout)
if (!isActive) return@launch

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary since delay is a suspension function

@@ -331,11 +303,11 @@ class Socket(

private fun close() {
processingChannel?.close()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just make this nonnull and declare it on creation like parent job?
If you really needed you could make the creation lazy and resettable

launch(parent = parentJob) {
messagesChannel.send(message)
}
launch(parentJob) { messagesChannel.send(message) }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You really shouldn't do this if you essentially expect unlimited channel sizes. Otherwise once you have a buffer you'll just be launching a bunch of jobs to wait for the channel to fill. You should either make this suspended, or enforce an UNLIMITED capacity and use offer, which doesn't suspend. You can look up 'backpressure' for more info. This applies for every launch -> send logic.

logger.debug { "Parent job: $parentJob" }
}
launch(parent = parentJob) {
launch {
if (processingChannel == null || processingChannel?.isFull == true || processingChannel?.isClosedForSend == true) {
logger.debug { "processing channel is in trouble... $processingChannel - full ${processingChannel?.isFull} - closedForSend ${processingChannel?.isClosedForSend}" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of checking this if you are still going to send a message so long as a channel is null? Your code is going to crash if you send a value when a channel doesn't allow it

@philipbrito
Copy link
Contributor Author

@AllanWang I'll make the changes here while making sure it is still a WIP PR.
Thanks for reviewing it!

@philipbrito philipbrito changed the title [NEW][WIP] Video call support [NEW] Video call support Mar 16, 2019
@philipbrito
Copy link
Contributor Author

philipbrito commented Mar 16, 2019

Coroutines improvements which need to be done (introduced on this PR) will be addressed here: #239

@philipbrito philipbrito changed the title [NEW] Video call support [NEW] Video conference Mar 18, 2019
@philipbrito philipbrito merged commit 38f60f1 into develop Mar 18, 2019
@philipbrito philipbrito deleted the new/video-call-support branch March 18, 2019 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants