Avoid busy looping as the VideoReceiveStream is shut down.

BUG=webrtc:7269

Review-Url: https://codereview.webrtc.org/2720963003
Cr-Commit-Position: refs/heads/master@{#16910}
This commit is contained in:
philipel 2017-02-28 07:19:43 -08:00 committed by Commit bot
parent aebc61e3dc
commit 2dfea3e548
2 changed files with 5 additions and 5 deletions

View File

@ -468,18 +468,17 @@ void VideoReceiveStream::SetMinimumPlayoutDelay(int delay_ms) {
}
bool VideoReceiveStream::DecodeThreadFunction(void* ptr) {
static_cast<VideoReceiveStream*>(ptr)->Decode();
return true;
return static_cast<VideoReceiveStream*>(ptr)->Decode();
}
void VideoReceiveStream::Decode() {
bool VideoReceiveStream::Decode() {
static const int kMaxWaitForFrameMs = 3000;
std::unique_ptr<video_coding::FrameObject> frame;
video_coding::FrameBuffer::ReturnReason res =
frame_buffer_->NextFrame(kMaxWaitForFrameMs, &frame);
if (res == video_coding::FrameBuffer::ReturnReason::kStopped)
return;
return false;
if (frame) {
if (video_receiver_.Decode(frame.get()) == VCM_OK)
@ -489,6 +488,7 @@ void VideoReceiveStream::Decode() {
<< " ms, requesting keyframe.";
RequestKeyFrame();
}
return true;
}
} // namespace internal
} // namespace webrtc

View File

@ -111,7 +111,7 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
private:
static bool DecodeThreadFunction(void* ptr);
void Decode();
bool Decode();
rtc::ThreadChecker worker_thread_checker_;
rtc::ThreadChecker module_process_thread_checker_;