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

Side by Side Diff: webrtc/common_video/incoming_video_stream.cc

Issue 2097403002: Add a race-checking mechanism. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: space between ctor Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 rtc::CritScope cs(&buffer_critsect_); 42 rtc::CritScope cs(&buffer_critsect_);
43 render_buffers_.reset(); 43 render_buffers_.reset();
44 } 44 }
45 45
46 deliver_buffer_event_->Set(); 46 deliver_buffer_event_->Set();
47 incoming_render_thread_.Stop(); 47 incoming_render_thread_.Stop();
48 deliver_buffer_event_->StopTimer(); 48 deliver_buffer_event_->StopTimer();
49 } 49 }
50 50
51 void IncomingVideoStream::OnFrame(const VideoFrame& video_frame) { 51 void IncomingVideoStream::OnFrame(const VideoFrame& video_frame) {
52 // Most of the time we'll be on a decoder thread here, but when using 52 RTC_CHECK_RUNS_SYNCHRONIZED(&decoder_race_checker_);
53 // VideoToolbox on iOS, we'll get called on a thread from a thread pool.
54
55 // Hand over or insert frame. 53 // Hand over or insert frame.
56 rtc::CritScope csB(&buffer_critsect_); 54 rtc::CritScope csB(&buffer_critsect_);
57 if (render_buffers_->AddFrame(video_frame) == 1) { 55 if (render_buffers_->AddFrame(video_frame) == 1) {
58 deliver_buffer_event_->Set(); 56 deliver_buffer_event_->Set();
59 } 57 }
60 } 58 }
61 59
62 bool IncomingVideoStream::IncomingVideoStreamThreadFun(void* obj) { 60 bool IncomingVideoStream::IncomingVideoStreamThreadFun(void* obj) {
63 return static_cast<IncomingVideoStream*>(obj)->IncomingVideoStreamProcess(); 61 return static_cast<IncomingVideoStream*>(obj)->IncomingVideoStreamProcess();
64 } 62 }
(...skipping 23 matching lines...) Expand all
88 deliver_buffer_event_->StartTimer(false, wait_time); 86 deliver_buffer_event_->StartTimer(false, wait_time);
89 87
90 if (frame_to_render) { 88 if (frame_to_render) {
91 external_callback_->OnFrame(*frame_to_render); 89 external_callback_->OnFrame(*frame_to_render);
92 } 90 }
93 } 91 }
94 return true; 92 return true;
95 } 93 }
96 94
97 } // namespace webrtc 95 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698