DescriptionSplit 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 #Messages
Total messages: 55 (15 generated)
|