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

Unified Diff: content/renderer/media/rtc_video_decoder.cc

Issue 1817573004: Handle HW decode failures in RTCVideoDecoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/rtc_video_decoder.cc
diff --git a/content/renderer/media/rtc_video_decoder.cc b/content/renderer/media/rtc_video_decoder.cc
index 069f418225ddb88e775ee34db6041b3dd122fd5e..7e2ead8097ad29df34639ad3d7499bd813c26e88 100644
--- a/content/renderer/media/rtc_video_decoder.cc
+++ b/content/renderer/media/rtc_video_decoder.cc
@@ -160,6 +160,11 @@ int32_t RTCVideoDecoder::Decode(
if (state_ == DECODE_ERROR) {
LOG(ERROR) << "Decoding error occurred.";
+ // Try restarting the session. It is OK to drop the frames until a keyframe
+ // is received.
+ factories_->GetTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(&RTCVideoDecoder::ResetInternal,
+ weak_factory_.GetWeakPtr()));
return WEBRTC_VIDEO_CODEC_ERROR;
}
@@ -607,6 +612,13 @@ void RTCVideoDecoder::MovePendingBuffersToDecodeBuffers() {
void RTCVideoDecoder::ResetInternal() {
DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
DVLOG(2) << "ResetInternal";
+
+ if (!vda_) {
+ base::WaitableEvent waiter(true, false);
+ CreateVDA(vda_codec_profile_, &waiter);
+ waiter.Wait();;
tommi (sloooow) - chröme 2016/03/19 09:25:49 One semicolon. Can we avoid waiting?
emircan 2016/03/21 19:25:09 Done.
+ }
+
if (vda_)
tommi (sloooow) - chröme 2016/03/19 09:25:49 Turn this into an else?
emircan 2016/03/21 19:25:09 Done.
vda_->Reset();
}
@@ -680,6 +692,7 @@ void RTCVideoDecoder::CreateVDA(media::VideoCodecProfile profile,
media::VideoDecodeAccelerator::Config config(profile);
if (vda_ && !vda_->Initialize(config, this))
vda_.release()->Destroy();
+ vda_codec_profile_ = profile;
}
waiter->Signal();
@@ -705,7 +718,14 @@ void RTCVideoDecoder::DestroyVDA() {
if (vda_)
vda_.release()->Destroy();
DestroyTextures();
+
base::AutoLock auto_lock(lock_);
+
+ // Put the buffers back in case we restart the decoder.
+ for (const auto& buffer : bitstream_buffers_in_decoder_)
+ PutSHM_Locked(scoped_ptr<base::SharedMemory>(buffer.second));
+ bitstream_buffers_in_decoder_.clear();
+
state_ = UNINITIALIZED;
}

Powered by Google App Engine
This is Rietveld 408576698