Wait for keyframe after decoding error.

Bug: chromium:936715
Change-Id: I0a51c8fa0025cb0f8e9afcbe8d8e4a84c2709ecf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/134960
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27827}
This commit is contained in:
philipel
2019-05-02 13:53:10 +02:00
committed by Commit Bot
parent 7e03b43a00
commit cd936fdba5
4 changed files with 7 additions and 9 deletions

View File

@ -153,7 +153,8 @@ FrameBuffer::ReturnReason FrameBuffer::NextFrame(
// means that the frame buffer was cleared as the thread in this function // means that the frame buffer was cleared as the thread in this function
// was waiting to acquire |crit_| in order to return. Wait for the // was waiting to acquire |crit_| in order to return. Wait for the
// remaining time and then return. // remaining time and then return.
return NextFrame(latest_return_time_ms - now_ms, frame_out); return NextFrame(latest_return_time_ms - now_ms, frame_out,
keyframe_required);
} }
return kTimeout; return kTimeout;
} }

View File

@ -65,7 +65,7 @@ class FrameBuffer {
// - If the FrameBuffer is stopped then it will return kStopped. // - If the FrameBuffer is stopped then it will return kStopped.
ReturnReason NextFrame(int64_t max_wait_time_ms, ReturnReason NextFrame(int64_t max_wait_time_ms,
std::unique_ptr<EncodedFrame>* frame_out, std::unique_ptr<EncodedFrame>* frame_out,
bool keyframe_required = false); bool keyframe_required);
void NextFrame( void NextFrame(
int64_t max_wait_time_ms, int64_t max_wait_time_ms,
bool keyframe_required, bool keyframe_required,

View File

@ -251,7 +251,7 @@ class TestFrameBuffer2 : public ::testing::Test {
std::unique_ptr<EncodedFrame> frame; std::unique_ptr<EncodedFrame> frame;
FrameBuffer::ReturnReason res = FrameBuffer::ReturnReason res =
tfb->buffer_->NextFrame(tfb->max_wait_time_, &frame); tfb->buffer_->NextFrame(tfb->max_wait_time_, &frame, false);
if (res != FrameBuffer::ReturnReason::kStopped) if (res != FrameBuffer::ReturnReason::kStopped)
tfb->frames_.emplace_back(std::move(frame)); tfb->frames_.emplace_back(std::move(frame));
} }

View File

@ -618,10 +618,8 @@ void VideoReceiveStream::StartNextDecode() {
std::unique_ptr<EncodedFrame> frame; std::unique_ptr<EncodedFrame> frame;
}; };
// TODO(philipel): Call NextFrame with |keyframe_required| argument set when
// downstream project has been fixed.
frame_buffer_->NextFrame( frame_buffer_->NextFrame(
GetWaitMs(), /*keyframe_required*/ false, &decode_queue_, GetWaitMs(), keyframe_required_, &decode_queue_,
[this](std::unique_ptr<EncodedFrame> frame, ReturnReason res) { [this](std::unique_ptr<EncodedFrame> frame, ReturnReason res) {
RTC_DCHECK_EQ(frame == nullptr, res == ReturnReason::kTimeout); RTC_DCHECK_EQ(frame == nullptr, res == ReturnReason::kTimeout);
RTC_DCHECK_EQ(frame != nullptr, res == ReturnReason::kFrameFound); RTC_DCHECK_EQ(frame != nullptr, res == ReturnReason::kFrameFound);
@ -640,10 +638,9 @@ bool VideoReceiveStream::Decode() {
TRACE_EVENT0("webrtc", "VideoReceiveStream::Decode"); TRACE_EVENT0("webrtc", "VideoReceiveStream::Decode");
std::unique_ptr<video_coding::EncodedFrame> frame; std::unique_ptr<video_coding::EncodedFrame> frame;
// TODO(philipel): Call NextFrame with |keyframe_required| argument when
// downstream project has been fixed.
video_coding::FrameBuffer::ReturnReason res = video_coding::FrameBuffer::ReturnReason res =
frame_buffer_->NextFrame(GetWaitMs(), &frame); frame_buffer_->NextFrame(GetWaitMs(), &frame, keyframe_required_);
if (res == ReturnReason::kStopped) { if (res == ReturnReason::kStopped) {
return false; return false;
} }