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

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

Issue 900053002: Minor robustness improvements for VTVideoDecodeAccelerator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment. Created 5 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 | « no previous file | 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.cc
diff --git a/content/common/gpu/media/vt_video_decode_accelerator.cc b/content/common/gpu/media/vt_video_decode_accelerator.cc
index e18412c114c9ed80cda02d5dc3fa2bd22eab42b1..dd65c8048d29db46a63a96ace5b28b9a2dad8e3a 100644
--- a/content/common/gpu/media/vt_video_decode_accelerator.cc
+++ b/content/common/gpu/media/vt_video_decode_accelerator.cc
@@ -632,15 +632,27 @@ void VTVideoDecodeAccelerator::Output(
CVImageBufferRef image_buffer) {
if (status) {
NOTIFY_STATUS("Decoding", status);
- } else if (CFGetTypeID(image_buffer) != CVPixelBufferGetTypeID()) {
+ return;
+ }
+
+ // The type of |image_buffer| is CVImageBuffer, but we only handle
+ // CVPixelBuffers. This should be guaranteed as we set
+ // kCVPixelBufferOpenGLCompatibilityKey in |image_config|.
+ //
+ // Sometimes, for unknown reasons (http://crbug.com/453050), |image_buffer| is
+ // NULL, which causes CFGetTypeID() to crash. While the rest of the code would
+ // smoothly handle NULL as a dropped frame, we choose to fail permanantly here
+ // until the issue is better understood.
+ if (!image_buffer || CFGetTypeID(image_buffer) != CVPixelBufferGetTypeID()) {
DLOG(ERROR) << "Decoded frame is not a CVPixelBuffer";
NotifyError(PLATFORM_FAILURE);
- } else {
- Frame* frame = reinterpret_cast<Frame*>(source_frame_refcon);
- frame->image.reset(image_buffer, base::scoped_policy::RETAIN);
- gpu_task_runner_->PostTask(FROM_HERE, base::Bind(
- &VTVideoDecodeAccelerator::DecodeDone, weak_this_, frame));
+ return;
}
+
+ Frame* frame = reinterpret_cast<Frame*>(source_frame_refcon);
+ frame->image.reset(image_buffer, base::scoped_policy::RETAIN);
+ gpu_task_runner_->PostTask(FROM_HERE, base::Bind(
+ &VTVideoDecodeAccelerator::DecodeDone, weak_this_, frame));
}
void VTVideoDecodeAccelerator::DecodeDone(Frame* frame) {
@@ -715,7 +727,10 @@ void VTVideoDecodeAccelerator::ProcessWorkQueues() {
switch (state_) {
case STATE_DECODING:
// TODO(sandersd): Batch where possible.
- while (ProcessReorderQueue() || ProcessTaskQueue());
+ while (state_ == STATE_DECODING) {
+ if (!ProcessReorderQueue() && !ProcessTaskQueue())
+ break;
+ }
return;
case STATE_ERROR:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698