-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash where a remote stream is removed before the promise resolves.
setRemoteDescription() ("SRD") is executed on the main thread, does work on the webrtc signaling thread which has callbacks that jump back to the main thread to fire events and resolve the promise. The callback on the main thread needs to know about the stream, tracks and their receivers. Previously, we invoked native_peer_connection_ ->GetReceivers() in the main thread callback. This was problematic in this case: SRD that adds stream x SRD that removes stream x By the time we do GetReceivers() in the main thread callback the stream may already have been removed from the native_peer_connection_ by the second SRD call. This lead to a crash because it couldn't find the receivers of the added stream. The fix is to do the GetReceivers() call while still on the webrtc signaling thread and not do any querying of the native_peer_connection_'s state from the main thread callback. Calling SRD in succession without waiting for the promises to resolve is inherently racey but this ensures the events fire without crashing and that we end up in the correct state. The indeterminate (racey) part is whether or not the stream fired in the first ontrack/onaddstream events contain the first track or is empty. Bug: 759324 Change-Id: Icdbf6f255a046ddf67feee2e59dab48952219184 Reviewed-on: https://chromium-review.googlesource.com/647531 Reviewed-by: Guido Urdaneta <guidou@chromium.org> Commit-Queue: Henrik Boström <hbos@chromium.org> Cr-Commit-Position: refs/heads/master@{#499601}
- Loading branch information
Showing
9 changed files
with
189 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.