From 9755f97e7f6ac638b27137ecc52b48317baaa95d Mon Sep 17 00:00:00 2001 From: Jonas Oreland Date: Fri, 16 Aug 2019 15:54:05 +0200 Subject: [PATCH] Update constributing source before publishing frame This patch is a follow up to https://webrtc-review.googlesource.com/c/src/+/143177. That patch modified the updating of CSRCS until "publishing" the frame to the renderer, however the update was added to just after calling renderer->OnFrame(video_frame). This patch reverses the calls of renderer->OnFrame(video_frame) and source_tracker_.OnFrameDelivered(video_frame.packet_infos()) so that the CSRCS are available when the frame is available. This fixes the the flakes described in webrtc:10827 that has a test that checks the CSRCs directly after a frame is available. Note: an optimal/correct solution would be to update the renderer and the source tracker in the same critical section so that they would be available at the same time. Bug: webrtc:10827 Change-Id: Ibf6efa832d8f2f2bcce0a9b0b946188bb67d48b1 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149171 Reviewed-by: Niels Moller Reviewed-by: Chen Xing Reviewed-by: Ilya Nikolaevskiy Commit-Queue: Jonas Oreland Cr-Commit-Position: refs/heads/master@{#28885} --- video/video_receive_stream.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/video/video_receive_stream.cc b/video/video_receive_stream.cc index ef1ac85842..df27405b45 100644 --- a/video/video_receive_stream.cc +++ b/video/video_receive_stream.cc @@ -540,9 +540,10 @@ void VideoReceiveStream::OnFrame(const VideoFrame& video_frame) { // TODO(tommi): OnSyncOffsetUpdated grabs a lock. stats_proxy_.OnSyncOffsetUpdated(sync_offset_ms, estimated_freq_khz); } + source_tracker_.OnFrameDelivered(video_frame.packet_infos()); + config_.renderer->OnFrame(video_frame); - source_tracker_.OnFrameDelivered(video_frame.packet_infos()); // TODO(tommi): OnRenderFrame grabs a lock too. stats_proxy_.OnRenderedFrame(video_frame); }