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

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: tommi@ comments. 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..d5b36809b2eda5d3d82f7f66b912dd88df5a95ef 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,
mcasas 2016/03/23 18:29:56 Shouldn't we make sure that the |state_ = RESETTIN
emircan 2016/03/25 02:33:31 Agreed. I will set it here(a) since all |state_| m
+ weak_factory_.GetWeakPtr()));
return WEBRTC_VIDEO_CODEC_ERROR;
mcasas 2016/03/23 18:29:56 Following offline conversation, please add some ki
emircan 2016/03/25 02:33:31 Done.
}
@@ -607,8 +612,11 @@ void RTCVideoDecoder::MovePendingBuffersToDecodeBuffers() {
void RTCVideoDecoder::ResetInternal() {
DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
DVLOG(2) << "ResetInternal";
mcasas 2016/03/23 18:29:56 nit: Move this to before the DCHECK and use DVLOG(
emircan 2016/03/25 02:33:31 Done.
+
if (vda_)
vda_->Reset();
+ else
pbos 2016/03/22 21:20:43 {}s for if-elses
mcasas 2016/03/23 18:29:56 Not for both bodies being one-liners. https://goo
+ CreateVDA(vda_codec_profile_, nullptr);
}
// static
@@ -680,9 +688,11 @@ 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();
+ if (waiter)
+ waiter->Signal();
}
void RTCVideoDecoder::DestroyTextures() {
@@ -705,7 +715,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));
mcasas 2016/03/23 18:29:57 nit: totally not your problem and prob beyond this
emircan 2016/03/25 02:33:31 I agree the name is confusing. They specify "lock_
+ bitstream_buffers_in_decoder_.clear();
+
state_ = UNINITIALIZED;
}

Powered by Google App Engine
This is Rietveld 408576698