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

Unified Diff: content/common/gpu/media/vt_video_decode_accelerator_mac.cc

Issue 1679503002: Drop frames until first IDR in VTVDA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reduce spam. Created 4 years, 10 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
« no previous file with comments | « content/common/gpu/media/vt_video_decode_accelerator_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/vt_video_decode_accelerator_mac.cc
diff --git a/content/common/gpu/media/vt_video_decode_accelerator_mac.cc b/content/common/gpu/media/vt_video_decode_accelerator_mac.cc
index 19b65c5bb12ec83a5da17ef83bee84eedac65dca..e74e6f64d55e610d4dc49d3cfe01c99f06b053a3 100644
--- a/content/common/gpu/media/vt_video_decode_accelerator_mac.cc
+++ b/content/common/gpu/media/vt_video_decode_accelerator_mac.cc
@@ -302,6 +302,8 @@ VTVideoDecodeAccelerator::VTVideoDecodeAccelerator(
session_(nullptr),
last_sps_id_(-1),
last_pps_id_(-1),
+ config_changed_(false),
+ missing_idr_logged_(false),
gpu_task_runner_(base::ThreadTaskRunnerHandle::Get()),
decoder_thread_("VTDecoderThread"),
weak_this_factory_(this) {
@@ -610,37 +612,53 @@ void VTVideoDecodeAccelerator::DecodeTask(
}
// Initialize VideoToolbox.
- bool config_changed = false;
if (!sps.empty() && sps != last_sps_) {
last_sps_.swap(sps);
last_spsext_.swap(spsext);
- config_changed = true;
+ config_changed_ = true;
}
if (!pps.empty() && pps != last_pps_) {
last_pps_.swap(pps);
- config_changed = true;
+ config_changed_ = true;
}
- if (config_changed) {
+ if (config_changed_) {
if (last_sps_.empty()) {
+ config_changed_ = false;
DLOG(ERROR) << "Invalid configuration; no SPS";
NotifyError(INVALID_ARGUMENT, SFT_INVALID_STREAM);
return;
}
if (last_pps_.empty()) {
+ config_changed_ = false;
DLOG(ERROR) << "Invalid configuration; no PPS";
NotifyError(INVALID_ARGUMENT, SFT_INVALID_STREAM);
return;
}
- // If it's not an IDR frame, we can't reconfigure the decoder anyway. We
- // assume that any config change not on an IDR must be compatible.
- if (frame->is_idr && !ConfigureDecoder())
- return;
+ // Only reconfigure at IDRs to avoid corruption.
+ if (frame->is_idr) {
+ config_changed_ = false;
+
+ // ConfigureDecoder() calls NotifyError() on failure.
+ if (!ConfigureDecoder())
+ return;
+ }
+ }
+
+ // If no IDR has been seen yet, skip decoding.
+ if (has_slice && !session_ && config_changed_) {
+ if (!missing_idr_logged_) {
+ LOG(ERROR) << "Illegal attempt to decode without IDR. "
+ << "Discarding decode requests until next IDR.";
+ missing_idr_logged_ = true;
DaleCurtis 2016/02/05 23:50:08 Do you want to reset this to false after the first
sandersd (OOO until July 31) 2016/02/05 23:53:52 We could do that, but I'm mostly just concerned wi
+ }
+ has_slice = false;
}
- // If there are no image slices, drop the bitstream buffer by returning an
+ // If there is nothing to decode, drop the bitstream buffer by returning an
// empty frame.
if (!has_slice) {
+ // Keep everything in order by flushing first.
if (!FinishDelayedFrames())
return;
gpu_task_runner_->PostTask(FROM_HERE, base::Bind(
« no previous file with comments | « content/common/gpu/media/vt_video_decode_accelerator_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698