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

Side by Side Diff: webrtc/video/video_receive_stream.cc

Issue 2720963003: Avoid busy looping as the VideoReceiveStream is shut down. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « webrtc/video/video_receive_stream.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 RTC_NOTREACHED(); 461 RTC_NOTREACHED();
462 return 0; 462 return 0;
463 } 463 }
464 464
465 void VideoReceiveStream::SetMinimumPlayoutDelay(int delay_ms) { 465 void VideoReceiveStream::SetMinimumPlayoutDelay(int delay_ms) {
466 RTC_DCHECK_RUN_ON(&module_process_thread_checker_); 466 RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
467 video_receiver_.SetMinimumPlayoutDelay(delay_ms); 467 video_receiver_.SetMinimumPlayoutDelay(delay_ms);
468 } 468 }
469 469
470 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) { 470 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) {
471 static_cast<VideoReceiveStream*>(ptr)->Decode(); 471 return static_cast<VideoReceiveStream*>(ptr)->Decode();
472 return true;
473 } 472 }
474 473
475 void VideoReceiveStream::Decode() { 474 bool VideoReceiveStream::Decode() {
476 static const int kMaxWaitForFrameMs = 3000; 475 static const int kMaxWaitForFrameMs = 3000;
477 std::unique_ptr<video_coding::FrameObject> frame; 476 std::unique_ptr<video_coding::FrameObject> frame;
478 video_coding::FrameBuffer::ReturnReason res = 477 video_coding::FrameBuffer::ReturnReason res =
479 frame_buffer_->NextFrame(kMaxWaitForFrameMs, &frame); 478 frame_buffer_->NextFrame(kMaxWaitForFrameMs, &frame);
480 479
481 if (res == video_coding::FrameBuffer::ReturnReason::kStopped) 480 if (res == video_coding::FrameBuffer::ReturnReason::kStopped)
482 return; 481 return false;
483 482
484 if (frame) { 483 if (frame) {
485 if (video_receiver_.Decode(frame.get()) == VCM_OK) 484 if (video_receiver_.Decode(frame.get()) == VCM_OK)
486 rtp_stream_receiver_.FrameDecoded(frame->picture_id); 485 rtp_stream_receiver_.FrameDecoded(frame->picture_id);
487 } else { 486 } else {
488 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs 487 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs
489 << " ms, requesting keyframe."; 488 << " ms, requesting keyframe.";
490 RequestKeyFrame(); 489 RequestKeyFrame();
491 } 490 }
491 return true;
492 } 492 }
493 } // namespace internal 493 } // namespace internal
494 } // namespace webrtc 494 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_receive_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698