Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Issue 2035173002: Split IncomingVideoStream into two implementations, with smoothing and without. (Closed)

Created:
4 years, 6 months ago by tommi
Modified:
4 years, 6 months ago
Reviewers:
mflodman
CC:
webrtc-reviews_webrtc.org, video-team_agora.io, yujie_mao (webrtc), zhengzhonghou_agora.io, stefan-webrtc, tterriberry_mozilla.com, pbos-webrtc, perkj_webrtc, mflodman
Base URL:
https://chromium.googlesource.com/external/webrtc.git@master
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

Split IncomingVideoStream into two implementations, with smoothing and without. This CL fixes an issue with the non-smoothing implementation where frames were delivered on the decoder thread. No-smoothing is now done in a separate class that uses a TaskQueue. The implementation may drop frames if the renderer doesn't keep up and it doesn't block the decoder thread. Further work done: * I added TODOs and documentation for VideoReceiveStream::OnFrame, where we today grab 5 locks. * I removed the Start/Stop methods from the IncomingVideoStream implementations. Now, when an instance is created, it should be considered to be "running" and when it is deleted, it's "not running". This saves on resources and also reduces the amount of locking required and I could remove one critical section altogether. * I changed the VideoStreamDecoder class to not depend on IncomingVideoStream but rather use the generic rtc::VideoSinkInterface<VideoFrame> interface. This means that any implementation of that interface can be used and the decoder can be made to just use the 'renderer' from the config. Once we do that, we can decouple the IncomingVideoStream implementations from the decoder and VideoReceiveStream implementations and leave it up to the application for how to do smoothing. The app can choose to use the Incoming* classes or roll its own (which may be preferable since applications often have their own scheduling mechanisms). * The non-smoothing IncomingVideoStream implementation currently allows only 1 outstanding pending frame. If we exceed that, the current frame won't be delivered to the renderer and instead we deliver the next one (since when this happens, the renderer is falling behind). * The lifetime of the VideoStreamDecoder instance is now bound to Start/Stop in VideoReceiveStream and not all of the lifetime of VideoReceiveStream. * Fixed VideoStreamDecoder to unregister callbacks in the dtor that were registered in the ctor. (this was open to a use-after-free regression) * Delay and callback pointers are now passed via the ctors to the IncomingVideoStream classes. The thread primitives in the IncomingVideoStream classes are also constructed/destructed at the same time as the owning object, which allowed me to remove one more lock. * Removed code in the VideoStreamDecoder that could overwrite the VideoReceiveStream render delay with a fixed value of 10ms on construction. This wasn't a problem with the previous implementation (it would be now though) but seemed to me like the wrong place to be setting that value. * Made the render delay value in VideoRenderFrames, const. BUG= Committed: https://crrev.com/1c7eef652b0aa22d8ebb0bfe2b547094a794be22 Cr-Commit-Position: refs/heads/master@{#13129}

Patch Set 1 #

Patch Set 2 : Update build files #

Patch Set 3 : Fix GN #

Patch Set 4 : Try non-smoothing #

Patch Set 5 : Back to default #

Patch Set 6 : Add TODOs with info on locking and assume we always have a renderer #

Patch Set 7 : no threads if no frame delivery, update tests, decoder only needs sink (not IncomingVideoFrame) #

Patch Set 8 : Allow maximum 1 frame to be pending at any given time #

Patch Set 9 : Remove base class, start/stop, RAII, remove 'running_', remove one critsec #

Patch Set 10 : Delete unused variable #

Patch Set 11 : Make lifetime of video_stream_decoder_ match Start/Stop #

Patch Set 12 : Change delay expectations #

Patch Set 13 : Fix VideoStreamDecoder to unregister callbacks in dtor, restore e2e expectations, set separate rend… #

Patch Set 14 : Rename IncomingVideoStreamImpl back to IncomingVideoStream #

Patch Set 15 : Remove SetRenderDelay from VideoRenderFrames and pass it via the ctor instead (member becomes const) #

Patch Set 16 : Remove one more lock in IncomingVideoStream #

Patch Set 17 : Remove one more lock in IncomingVideoStream #

Patch Set 18 : Rebase #

Patch Set 19 : Add a couple of tests for the non-smoothing incoming stream implementation #

Patch Set 20 : Rebase #

Patch Set 21 : Fix merge #

Patch Set 22 : Rebase again #

Total comments: 12

Patch Set 23 : Address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+283 lines, -210 lines) Patch
M webrtc/common_video/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +2 lines, -0 lines 0 comments Download
M webrtc/common_video/common_video.gyp View 1 1 chunk +1 line, -0 lines 0 comments Download
M webrtc/common_video/common_video_unittests.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +1 line, -0 lines 0 comments Download
M webrtc/common_video/include/incoming_video_stream.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +30 lines, -28 lines 0 comments Download
M webrtc/common_video/incoming_video_stream.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 4 chunks +53 lines, -101 lines 0 comments Download
A webrtc/common_video/incoming_video_stream_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +88 lines, -0 lines 0 comments Download
M webrtc/common_video/video_render_frames.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 3 chunks +3 lines, -8 lines 0 comments Download
M webrtc/common_video/video_render_frames.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 3 chunks +11 lines, -23 lines 0 comments Download
M webrtc/media/base/videosinkinterface.h View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -2 lines 0 comments Download
M webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +2 lines, -2 lines 0 comments Download
M webrtc/video/end_to_end_tests.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 6 chunks +16 lines, -1 line 0 comments Download
M webrtc/video/video_receive_stream.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +2 lines, -2 lines 0 comments Download
M webrtc/video/video_receive_stream.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 9 chunks +50 lines, -21 lines 0 comments Download
M webrtc/video/video_stream_decoder.h View 1 2 3 4 5 6 7 8 9 10 4 chunks +5 lines, -7 lines 0 comments Download
M webrtc/video/video_stream_decoder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 5 chunks +17 lines, -15 lines 0 comments Download

Messages

Total messages: 55 (15 generated)
tommi
Update build files
4 years, 6 months ago (2016-06-03 21:15:45 UTC) #1
tommi
Fix GN
4 years, 6 months ago (2016-06-03 21:19:08 UTC) #2
tommi
Try non-smoothing
4 years, 6 months ago (2016-06-03 21:26:50 UTC) #3
tommi
Back to default
4 years, 6 months ago (2016-06-03 21:34:00 UTC) #4
tommi
Add TODOs with info on locking and assume we always have a renderer
4 years, 6 months ago (2016-06-04 17:02:16 UTC) #5
tommi
Allow maximum 1 frame to be pending at any given time
4 years, 6 months ago (2016-06-05 09:47:53 UTC) #6
tommi
Remove base class, start/stop, RAII, remove 'running_', remove one critsec
4 years, 6 months ago (2016-06-05 10:49:38 UTC) #7
tommi
Delete unused variable
4 years, 6 months ago (2016-06-05 11:02:52 UTC) #8
tommi
Make lifetime of video_stream_decoder_ match Start/Stop
4 years, 6 months ago (2016-06-05 12:49:21 UTC) #9
tommi
Change delay expectations
4 years, 6 months ago (2016-06-05 14:16:18 UTC) #10
tommi
Fix VideoStreamDecoder to unregister callbacks in dtor, restore e2e expectations, set separate render callback
4 years, 6 months ago (2016-06-05 14:48:43 UTC) #11
tommi
Rename IncomingVideoStreamImpl back to IncomingVideoStream
4 years, 6 months ago (2016-06-05 19:04:31 UTC) #12
tommi
Remove SetRenderDelay from VideoRenderFrames and pass it via the ctor instead (member becomes const)
4 years, 6 months ago (2016-06-05 19:19:05 UTC) #13
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2035173002/280001
4 years, 6 months ago (2016-06-06 09:28:42 UTC) #15
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios64_gn_dbg on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/ios64_gn_dbg/builds/322)
4 years, 6 months ago (2016-06-06 09:32:43 UTC) #17
tommi
Remove one more lock in IncomingVideoStream
4 years, 6 months ago (2016-06-06 19:46:38 UTC) #18
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2035173002/290001
4 years, 6 months ago (2016-06-06 22:34:16 UTC) #20
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: android_compile_x86_dbg on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/android_compile_x86_dbg/builds/4491) android_gn_dbg on ...
4 years, 6 months ago (2016-06-06 22:35:28 UTC) #22
tommi
Remove one more lock in IncomingVideoStream
4 years, 6 months ago (2016-06-06 22:35:39 UTC) #23
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2035173002/310001
4 years, 6 months ago (2016-06-06 22:36:16 UTC) #25
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 6 months ago (2016-06-06 23:07:41 UTC) #27
tommi
4 years, 6 months ago (2016-06-08 10:08:31 UTC) #30
tommi
Rebase
4 years, 6 months ago (2016-06-10 14:26:45 UTC) #31
tommi
Add a couple of tests for the non-smoothing incoming stream implementation
4 years, 6 months ago (2016-06-10 15:35:20 UTC) #32
tommi
I've added a couple of tests for the non-smoothing implementation, which is the one that's ...
4 years, 6 months ago (2016-06-10 15:37:31 UTC) #33
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2035173002/350001
4 years, 6 months ago (2016-06-10 15:37:46 UTC) #35
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_drmemory_light on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/win_drmemory_light/builds/12711) win_x64_gn_dbg on ...
4 years, 6 months ago (2016-06-10 15:39:37 UTC) #37
tommi
Rebase
4 years, 6 months ago (2016-06-10 15:52:35 UTC) #38
tommi
Fix merge
4 years, 6 months ago (2016-06-10 15:57:18 UTC) #39
tommi
Rebase again
4 years, 6 months ago (2016-06-10 16:02:10 UTC) #40
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2035173002/410001
4 years, 6 months ago (2016-06-10 16:08:09 UTC) #42
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: android_rel on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/android_rel/builds/14084)
4 years, 6 months ago (2016-06-10 16:13:36 UTC) #44
mflodman
Nice to use the sink interface instead! A few comments. https://codereview.webrtc.org/2035173002/diff/410001/webrtc/common_video/include/incoming_video_stream.h File webrtc/common_video/include/incoming_video_stream.h (right): https://codereview.webrtc.org/2035173002/diff/410001/webrtc/common_video/include/incoming_video_stream.h#newcode29 ...
4 years, 6 months ago (2016-06-13 18:39:24 UTC) #45
tommi
Address comments
4 years, 6 months ago (2016-06-14 08:11:09 UTC) #46
tommi
https://codereview.webrtc.org/2035173002/diff/410001/webrtc/common_video/include/incoming_video_stream.h File webrtc/common_video/include/incoming_video_stream.h (right): https://codereview.webrtc.org/2035173002/diff/410001/webrtc/common_video/include/incoming_video_stream.h#newcode29 webrtc/common_video/include/incoming_video_stream.h:29: explicit IncomingVideoStream(int32_t delay_ms, On 2016/06/13 18:39:24, mflodman wrote: > ...
4 years, 6 months ago (2016-06-14 08:11:28 UTC) #47
mflodman
LGTM https://codereview.webrtc.org/2035173002/diff/410001/webrtc/common_video/video_render_frames.h File webrtc/common_video/video_render_frames.h (right): https://codereview.webrtc.org/2035173002/diff/410001/webrtc/common_video/video_render_frames.h#newcode36 webrtc/common_video/video_render_frames.h:36: int32_t ReleaseAllFrames(); On 2016/06/14 08:11:27, tommi-webrtc wrote: > ...
4 years, 6 months ago (2016-06-14 08:59:26 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2035173002/430001
4 years, 6 months ago (2016-06-14 09:08:07 UTC) #50
commit-bot: I haz the power
Committed patchset #23 (id:430001)
4 years, 6 months ago (2016-06-14 11:38:43 UTC) #52
commit-bot: I haz the power
Patchset 23 (id:??) landed as https://crrev.com/1c7eef652b0aa22d8ebb0bfe2b547094a794be22 Cr-Commit-Position: refs/heads/master@{#13129}
4 years, 6 months ago (2016-06-14 11:38:48 UTC) #54
tommi
4 years, 6 months ago (2016-06-14 23:04:22 UTC) #55
Message was sent while issue was closed.
A revert of this CL (patchset #23 id:430001) has been created in
https://codereview.webrtc.org/2061363002/ by tommi@webrtc.org.

The reason for reverting is: Reverting while we track down the issue on the
Win10 bot..

Powered by Google App Engine
This is Rietveld 408576698