Bug 828917: move critsect to cover thread existence test (upstream issue 1465) r=derf
authorRandell Jesup <rjesup@jesup.org>
Wed, 06 Mar 2013 13:40:39 -0500
changeset 124213 6cab296a494096fd4ddddbd07e8be0e4a7814a23
parent 124212 fadc3b10b211c0a8d747029d3306afa29944e7fc
child 124214 d7f59fd537d9a0b69f57dcfa287bdbdfa8b7664d
push id24293
push userryanvm@gmail.com
push dateFri, 08 Mar 2013 13:00:39 +0000
treeherdermozilla-inbound@d7f59fd537d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersderf
bugs828917
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 828917: move critsect to cover thread existence test (upstream issue 1465) r=derf
media/webrtc/trunk/webrtc/modules/video_render/incoming_video_stream.cc
--- a/media/webrtc/trunk/webrtc/modules/video_render/incoming_video_stream.cc
+++ b/media/webrtc/trunk/webrtc/modules/video_render/incoming_video_stream.cc
@@ -287,22 +287,23 @@ WebRtc_UWord32 IncomingVideoStream::Inco
 }
 
 bool IncomingVideoStream::IncomingVideoStreamThreadFun(void* obj) {
   return static_cast<IncomingVideoStream*>(obj)->IncomingVideoStreamProcess();
 }
 
 bool IncomingVideoStream::IncomingVideoStreamProcess() {
   if (kEventError != deliver_buffer_event_.Wait(KEventMaxWaitTimeMs)) {
+    thread_critsect_.Enter();
     if (incoming_render_thread_ == NULL) {
       // Terminating
+      thread_critsect_.Leave();
       return false;
     }
 
-    thread_critsect_.Enter();
     I420VideoFrame* frame_to_render = NULL;
 
     // Get a new frame to render and the time for the frame after this one.
     buffer_critsect_.Enter();
     frame_to_render = render_buffers_.FrameToRender();
     WebRtc_UWord32 wait_time = render_buffers_.TimeToNextFrameRelease();
     buffer_critsect_.Leave();