summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorposciak@chromium.org <posciak@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-29 19:44:05 +0000
committerposciak@chromium.org <posciak@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-29 19:44:05 +0000
commit75e61807f9798a096a67d2455574d46a785c8377 (patch)
treef3c42a9f39f55d121a7ff15cc16a4a69dbf68efb
parent466ef9f1dcff2c260491b4b1121219d301cc0463 (diff)
downloadchromium_src-75e61807f9798a096a67d2455574d46a785c8377.zip
chromium_src-75e61807f9798a096a67d2455574d46a785c8377.tar.gz
chromium_src-75e61807f9798a096a67d2455574d46a785c8377.tar.bz2
VAVDA: Allow Decode() during resetting.
Allow Decode() calls from clients after Reset() and before NotifyResetDone(). This will allow accumulating post-seek buffers while we are still finishing decoding pre-seek ones. Also don't return the frame that was being decoded at the time of Reset() call to the client, but reuse it immediately instead. BUG=171965 TEST=VDA unittest, HTML5 video seek stress test, Flash seek tests, manual seek tests Review URL: https://chromiumcodereview.appspot.com/12088034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179384 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/common/gpu/media/vaapi_video_decode_accelerator.cc40
1 files changed, 32 insertions, 8 deletions
diff --git a/content/common/gpu/media/vaapi_video_decode_accelerator.cc b/content/common/gpu/media/vaapi_video_decode_accelerator.cc
index 8a99064..679162c 100644
--- a/content/common/gpu/media/vaapi_video_decode_accelerator.cc
+++ b/content/common/gpu/media/vaapi_video_decode_accelerator.cc
@@ -138,6 +138,17 @@ void VaapiVideoDecodeAccelerator::NotifyPictureReady(int32 input_id,
if (!client_)
return;
+ // Don't return any pictures that we might want to return during resetting
+ // as a consequence of finishing up the decode that was running during
+ // Reset() call from the client. Reuse it instead.
+ {
+ base::AutoLock auto_lock(lock_);
+ if (state_ == kResetting) {
+ output_buffers_.push(output_id);
+ return;
+ }
+ }
+
++num_frames_at_client_;
TRACE_COUNTER1("Video Decoder", "Textures at client", num_frames_at_client_);
@@ -394,6 +405,9 @@ void VaapiVideoDecodeAccelerator::Decode(
break;
case kDecoding:
+ // Allow accumulating bitstream buffers so that the client can queue
+ // after-seek-buffers while we are finishing with the before-seek one.
+ case kResetting:
break;
case kIdle:
@@ -522,6 +536,14 @@ void VaapiVideoDecodeAccelerator::Reset() {
base::AutoLock auto_lock(lock_);
state_ = kResetting;
+ // Drop all remaining input buffers, if present.
+ while (!input_buffers_.empty()) {
+ message_loop_->PostTask(FROM_HERE, base::Bind(
+ &Client::NotifyEndOfBitstreamBuffer, client_,
+ input_buffers_.front()->id));
+ input_buffers_.pop();
+ }
+
decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(
&VaapiVideoDecodeAccelerator::ResetTask, base::Unretained(this)));
@@ -538,20 +560,22 @@ void VaapiVideoDecodeAccelerator::FinishReset() {
return; // We could've gotten destroyed already.
}
- // Drop all remaining input buffers, if present.
- while (!input_buffers_.empty()) {
- message_loop_->PostTask(FROM_HERE, base::Bind(
- &Client::NotifyEndOfBitstreamBuffer, client_,
- input_buffers_.front()->id));
- input_buffers_.pop();
- }
-
state_ = kIdle;
num_stream_bufs_at_decoder_ = 0;
message_loop_->PostTask(FROM_HERE, base::Bind(
&Client::NotifyResetDone, client_));
+ // The client might have given us new buffers via Decode() while we were
+ // resetting and might be waiting for our move, and not call Decode() anymore
+ // until we return something. Post an InitialDecodeTask() so that we won't
+ // sleep forever waiting for Decode() in that case. Having two of them
+ // in the pipe is harmless, the additional one will return as soon as it sees
+ // that we are back in kDecoding state.
+ decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(
+ &VaapiVideoDecodeAccelerator::InitialDecodeTask,
+ base::Unretained(this)));
+
DVLOG(1) << "Reset finished";
}