1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "media/filters/gpu_video_decoder.h"
10 #include "base/callback_helpers.h"
12 #include "base/message_loop/message_loop.h"
13 #include "base/metrics/histogram.h"
14 #include "base/stl_util.h"
15 #include "base/synchronization/waitable_event.h"
16 #include "base/task_runner_util.h"
17 #include "gpu/command_buffer/common/mailbox_holder.h"
18 #include "media/base/bind_to_current_loop.h"
19 #include "media/base/decoder_buffer.h"
20 #include "media/base/media_log.h"
21 #include "media/base/pipeline.h"
22 #include "media/base/pipeline_status.h"
23 #include "media/base/video_decoder_config.h"
24 #include "media/filters/gpu_video_accelerator_factories.h"
25 #include "third_party/skia/include/core/SkBitmap.h"
29 // Maximum number of concurrent VDA::Decode() operations GVD will maintain.
30 // Higher values allow better pipelining in the GPU, but also require more
32 enum { kMaxInFlightDecodes
= 4 };
34 // Size of shared-memory segments we allocate. Since we reuse them we let them
35 // be on the beefy side.
36 static const size_t kSharedMemorySegmentBytes
= 100 << 10;
38 GpuVideoDecoder::SHMBuffer::SHMBuffer(base::SharedMemory
* m
, size_t s
)
42 GpuVideoDecoder::SHMBuffer::~SHMBuffer() {}
44 GpuVideoDecoder::BufferPair::BufferPair(
45 SHMBuffer
* s
, const scoped_refptr
<DecoderBuffer
>& b
)
46 : shm_buffer(s
), buffer(b
) {
49 GpuVideoDecoder::BufferPair::~BufferPair() {}
51 GpuVideoDecoder::BufferData::BufferData(
52 int32 bbid
, base::TimeDelta ts
, const gfx::Rect
& vr
, const gfx::Size
& ns
)
53 : bitstream_buffer_id(bbid
), timestamp(ts
), visible_rect(vr
),
57 GpuVideoDecoder::BufferData::~BufferData() {}
59 GpuVideoDecoder::GpuVideoDecoder(
60 const scoped_refptr
<GpuVideoAcceleratorFactories
>& factories
,
61 const scoped_refptr
<MediaLog
>& media_log
)
62 : needs_bitstream_conversion_(false),
64 factories_(factories
),
66 media_log_(media_log
),
67 decoder_texture_target_(0),
68 next_picture_buffer_id_(0),
69 next_bitstream_buffer_id_(0),
70 available_pictures_(0) {
71 DCHECK(factories_
.get());
74 void GpuVideoDecoder::Reset(const base::Closure
& closure
) {
75 DVLOG(3) << "Reset()";
76 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
78 if (state_
== kDrainingDecoder
) {
79 base::MessageLoop::current()->PostTask(FROM_HERE
, base::Bind(
80 &GpuVideoDecoder::Reset
, weak_this_
, closure
));
81 // NOTE: if we're deferring Reset() until a Flush() completes, return
82 // queued pictures to the VDA so they can be used to finish that Flush().
83 if (pending_decode_cb_
.is_null())
84 ready_video_frames_
.clear();
88 // Throw away any already-decoded, not-yet-delivered frames.
89 ready_video_frames_
.clear();
92 base::MessageLoop::current()->PostTask(FROM_HERE
, closure
);
96 if (!pending_decode_cb_
.is_null())
97 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEOSFrame());
99 DCHECK(pending_reset_cb_
.is_null());
100 pending_reset_cb_
= BindToCurrentLoop(closure
);
105 void GpuVideoDecoder::Stop(const base::Closure
& closure
) {
106 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
109 if (!pending_decode_cb_
.is_null())
110 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEOSFrame());
111 if (!pending_reset_cb_
.is_null())
112 base::ResetAndReturn(&pending_reset_cb_
).Run();
113 BindToCurrentLoop(closure
).Run();
116 static bool IsCodedSizeSupported(const gfx::Size
& coded_size
) {
117 // Only non-Windows, Ivy Bridge+ platforms can support more than 1920x1080.
118 // We test against 1088 to account for 16x16 macroblocks.
119 if (coded_size
.width() <= 1920 && coded_size
.height() <= 1088)
123 bool hw_large_video_support
=
124 (cpu
.vendor_name() == "GenuineIntel") && cpu
.model() >= 55;
125 bool os_large_video_support
= true;
127 os_large_video_support
= false;
129 return os_large_video_support
&& hw_large_video_support
;
132 // Report |status| to UMA and run |cb| with it. This is super-specific to the
133 // UMA stat reported because the UMA_HISTOGRAM_ENUMERATION API requires a
134 // callsite to always be called with the same stat name (can't parameterize it).
135 static void ReportGpuVideoDecoderInitializeStatusToUMAAndRunCB(
136 const PipelineStatusCB
& cb
,
137 PipelineStatus status
) {
138 UMA_HISTOGRAM_ENUMERATION(
139 "Media.GpuVideoDecoderInitializeStatus", status
, PIPELINE_STATUS_MAX
+ 1);
143 void GpuVideoDecoder::Initialize(const VideoDecoderConfig
& config
,
144 const PipelineStatusCB
& orig_status_cb
) {
145 DVLOG(3) << "Initialize()";
146 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
147 DCHECK(config
.IsValidConfig());
148 DCHECK(!config
.is_encrypted());
150 weak_this_
= weak_factory_
.GetWeakPtr();
152 PipelineStatusCB status_cb
=
153 base::Bind(&ReportGpuVideoDecoderInitializeStatusToUMAAndRunCB
,
154 BindToCurrentLoop(orig_status_cb
));
156 bool previously_initialized
= config_
.IsValidConfig();
157 #if !defined(OS_CHROMEOS) && !defined(OS_WIN)
158 if (previously_initialized
) {
159 // TODO(xhwang): Make GpuVideoDecoder reinitializable.
160 // See http://crbug.com/233608
161 DVLOG(1) << "GpuVideoDecoder reinitialization not supported.";
162 status_cb
.Run(DECODER_ERROR_NOT_SUPPORTED
);
166 DVLOG(1) << "(Re)initializing GVD with config: "
167 << config
.AsHumanReadableString();
169 // TODO(posciak): destroy and create a new VDA on codec/profile change
170 // (http://crbug.com/260224).
171 if (previously_initialized
&& (config_
.profile() != config
.profile())) {
172 DVLOG(1) << "Codec or profile changed, cannot reinitialize.";
173 status_cb
.Run(DECODER_ERROR_NOT_SUPPORTED
);
177 if (!IsCodedSizeSupported(config
.coded_size())) {
178 status_cb
.Run(DECODER_ERROR_NOT_SUPPORTED
);
183 needs_bitstream_conversion_
= (config
.codec() == kCodecH264
);
185 if (previously_initialized
) {
186 // Reinitialization with a different config (but same codec and profile).
187 // VDA should handle it by detecting this in-stream by itself,
188 // no need to notify it.
189 status_cb
.Run(PIPELINE_OK
);
193 vda_
= factories_
->CreateVideoDecodeAccelerator(config
.profile()).Pass();
194 if (!vda_
|| !vda_
->Initialize(config
.profile(), this)) {
195 status_cb
.Run(DECODER_ERROR_NOT_SUPPORTED
);
199 DVLOG(3) << "GpuVideoDecoder::Initialize() succeeded.";
200 media_log_
->SetStringProperty("video_decoder", "gpu");
201 status_cb
.Run(PIPELINE_OK
);
204 void GpuVideoDecoder::DestroyPictureBuffers(PictureBufferMap
* buffers
) {
205 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
206 for (PictureBufferMap::iterator it
= buffers
->begin(); it
!= buffers
->end();
208 factories_
->DeleteTexture(it
->second
.texture_id());
214 void GpuVideoDecoder::DestroyVDA() {
215 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
218 vda_
.release()->Destroy();
220 DestroyPictureBuffers(&assigned_picture_buffers_
);
221 // Not destroying PictureBuffers in |dismissed_picture_buffers_| yet, since
222 // their textures may still be in use by the user of this GpuVideoDecoder.
225 void GpuVideoDecoder::Decode(const scoped_refptr
<DecoderBuffer
>& buffer
,
226 const DecodeCB
& decode_cb
) {
227 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
228 DCHECK(pending_reset_cb_
.is_null());
229 DCHECK(pending_decode_cb_
.is_null());
231 pending_decode_cb_
= BindToCurrentLoop(decode_cb
);
233 if (state_
== kError
|| !vda_
) {
234 base::ResetAndReturn(&pending_decode_cb_
).Run(kDecodeError
, NULL
);
239 case kDecoderDrained
:
240 if (!ready_video_frames_
.empty()) {
241 EnqueueFrameAndTriggerFrameDelivery(NULL
);
248 case kDrainingDecoder
:
249 DCHECK(buffer
->end_of_stream());
250 // Do nothing. Will be satisfied either by a PictureReady or
251 // NotifyFlushDone below.
258 if (buffer
->end_of_stream()) {
259 if (state_
== kNormal
) {
260 state_
= kDrainingDecoder
;
262 // If we have ready frames, go ahead and process them to ensure that the
263 // Flush operation does not block in the VDA due to lack of picture
265 if (!ready_video_frames_
.empty())
266 EnqueueFrameAndTriggerFrameDelivery(NULL
);
271 size_t size
= buffer
->data_size();
272 SHMBuffer
* shm_buffer
= GetSHM(size
);
274 base::ResetAndReturn(&pending_decode_cb_
).Run(kDecodeError
, NULL
);
278 memcpy(shm_buffer
->shm
->memory(), buffer
->data(), size
);
279 BitstreamBuffer
bitstream_buffer(
280 next_bitstream_buffer_id_
, shm_buffer
->shm
->handle(), size
);
281 // Mask against 30 bits, to avoid (undefined) wraparound on signed integer.
282 next_bitstream_buffer_id_
= (next_bitstream_buffer_id_
+ 1) & 0x3FFFFFFF;
283 bool inserted
= bitstream_buffers_in_decoder_
.insert(std::make_pair(
284 bitstream_buffer
.id(), BufferPair(shm_buffer
, buffer
))).second
;
286 RecordBufferData(bitstream_buffer
, *buffer
.get());
288 vda_
->Decode(bitstream_buffer
);
290 if (!ready_video_frames_
.empty()) {
291 EnqueueFrameAndTriggerFrameDelivery(NULL
);
295 if (CanMoreDecodeWorkBeDone())
296 base::ResetAndReturn(&pending_decode_cb_
).Run(kNotEnoughData
, NULL
);
299 bool GpuVideoDecoder::CanMoreDecodeWorkBeDone() {
300 return bitstream_buffers_in_decoder_
.size() < kMaxInFlightDecodes
;
303 void GpuVideoDecoder::RecordBufferData(const BitstreamBuffer
& bitstream_buffer
,
304 const DecoderBuffer
& buffer
) {
305 input_buffer_data_
.push_front(BufferData(bitstream_buffer
.id(),
307 config_
.visible_rect(),
308 config_
.natural_size()));
309 // Why this value? Because why not. avformat.h:MAX_REORDER_DELAY is 16, but
310 // that's too small for some pathological B-frame test videos. The cost of
311 // using too-high a value is low (192 bits per extra slot).
312 static const size_t kMaxInputBufferDataSize
= 128;
313 // Pop from the back of the list, because that's the oldest and least likely
314 // to be useful in the future data.
315 if (input_buffer_data_
.size() > kMaxInputBufferDataSize
)
316 input_buffer_data_
.pop_back();
319 void GpuVideoDecoder::GetBufferData(int32 id
, base::TimeDelta
* timestamp
,
320 gfx::Rect
* visible_rect
,
321 gfx::Size
* natural_size
) {
322 for (std::list
<BufferData
>::const_iterator it
=
323 input_buffer_data_
.begin(); it
!= input_buffer_data_
.end();
325 if (it
->bitstream_buffer_id
!= id
)
327 *timestamp
= it
->timestamp
;
328 *visible_rect
= it
->visible_rect
;
329 *natural_size
= it
->natural_size
;
332 NOTREACHED() << "Missing bitstreambuffer id: " << id
;
335 bool GpuVideoDecoder::HasAlpha() const {
336 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
340 bool GpuVideoDecoder::NeedsBitstreamConversion() const {
341 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
342 return needs_bitstream_conversion_
;
345 bool GpuVideoDecoder::CanReadWithoutStalling() const {
346 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
348 next_picture_buffer_id_
== 0 || // Decode() will ProvidePictureBuffers().
349 available_pictures_
> 0 || !ready_video_frames_
.empty();
352 void GpuVideoDecoder::NotifyInitializeDone() {
353 NOTREACHED() << "GpuVideoDecodeAcceleratorHost::Initialize is synchronous!";
356 void GpuVideoDecoder::ProvidePictureBuffers(uint32 count
,
357 const gfx::Size
& size
,
358 uint32 texture_target
) {
359 DVLOG(3) << "ProvidePictureBuffers(" << count
<< ", "
360 << size
.width() << "x" << size
.height() << ")";
361 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
363 std::vector
<uint32
> texture_ids
;
364 std::vector
<gpu::Mailbox
> texture_mailboxes
;
365 decoder_texture_target_
= texture_target
;
366 // Discards the sync point returned here since PictureReady will imply that
367 // the produce has already happened, and the texture is ready for use.
368 if (!factories_
->CreateTextures(count
,
372 decoder_texture_target_
)) {
373 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE
);
376 DCHECK_EQ(count
, texture_ids
.size());
377 DCHECK_EQ(count
, texture_mailboxes
.size());
382 std::vector
<PictureBuffer
> picture_buffers
;
383 for (size_t i
= 0; i
< texture_ids
.size(); ++i
) {
384 picture_buffers
.push_back(PictureBuffer(
385 next_picture_buffer_id_
++, size
, texture_ids
[i
], texture_mailboxes
[i
]));
386 bool inserted
= assigned_picture_buffers_
.insert(std::make_pair(
387 picture_buffers
.back().id(), picture_buffers
.back())).second
;
391 available_pictures_
+= count
;
393 vda_
->AssignPictureBuffers(picture_buffers
);
396 void GpuVideoDecoder::DismissPictureBuffer(int32 id
) {
397 DVLOG(3) << "DismissPictureBuffer(" << id
<< ")";
398 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
400 PictureBufferMap::iterator it
= assigned_picture_buffers_
.find(id
);
401 if (it
== assigned_picture_buffers_
.end()) {
402 NOTREACHED() << "Missing picture buffer: " << id
;
406 PictureBuffer buffer_to_dismiss
= it
->second
;
407 assigned_picture_buffers_
.erase(it
);
409 std::set
<int32
>::iterator at_display_it
=
410 picture_buffers_at_display_
.find(id
);
412 if (at_display_it
== picture_buffers_at_display_
.end()) {
413 // We can delete the texture immediately as it's not being displayed.
414 factories_
->DeleteTexture(buffer_to_dismiss
.texture_id());
415 CHECK_GT(available_pictures_
, 0);
416 --available_pictures_
;
418 // Texture in display. Postpone deletion until after it's returned to us.
419 bool inserted
= dismissed_picture_buffers_
.insert(std::make_pair(
420 id
, buffer_to_dismiss
)).second
;
425 static void ReadPixelsSyncInner(
426 const scoped_refptr
<media::GpuVideoAcceleratorFactories
>& factories
,
428 const gfx::Rect
& visible_rect
,
429 const SkBitmap
& pixels
,
430 base::WaitableEvent
* event
) {
431 factories
->ReadPixels(texture_id
, visible_rect
, pixels
);
435 static void ReadPixelsSync(
436 const scoped_refptr
<media::GpuVideoAcceleratorFactories
>& factories
,
438 const gfx::Rect
& visible_rect
,
439 const SkBitmap
& pixels
) {
440 base::WaitableEvent
event(true, false);
441 if (!factories
->GetTaskRunner()->PostTask(FROM_HERE
,
442 base::Bind(&ReadPixelsSyncInner
,
452 void GpuVideoDecoder::PictureReady(const media::Picture
& picture
) {
453 DVLOG(3) << "PictureReady()";
454 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
456 PictureBufferMap::iterator it
=
457 assigned_picture_buffers_
.find(picture
.picture_buffer_id());
458 if (it
== assigned_picture_buffers_
.end()) {
459 NOTREACHED() << "Missing picture buffer: " << picture
.picture_buffer_id();
460 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE
);
463 const PictureBuffer
& pb
= it
->second
;
465 // Update frame's timestamp.
466 base::TimeDelta timestamp
;
467 gfx::Rect visible_rect
;
468 gfx::Size natural_size
;
469 GetBufferData(picture
.bitstream_buffer_id(), ×tamp
, &visible_rect
,
471 DCHECK(decoder_texture_target_
);
473 scoped_refptr
<VideoFrame
> frame(VideoFrame::WrapNativeTexture(
474 make_scoped_ptr(new gpu::MailboxHolder(
475 pb
.texture_mailbox(), decoder_texture_target_
, 0 /* sync_point */)),
476 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::ReusePictureBuffer
,
478 picture
.picture_buffer_id())),
483 base::Bind(&ReadPixelsSync
, factories_
, pb
.texture_id(), visible_rect
)));
484 CHECK_GT(available_pictures_
, 0);
485 --available_pictures_
;
487 picture_buffers_at_display_
.insert(picture
.picture_buffer_id()).second
;
490 EnqueueFrameAndTriggerFrameDelivery(frame
);
493 void GpuVideoDecoder::EnqueueFrameAndTriggerFrameDelivery(
494 const scoped_refptr
<VideoFrame
>& frame
) {
495 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
497 // During a pending vda->Reset(), we don't accumulate frames. Drop it on the
499 if (!pending_reset_cb_
.is_null())
503 ready_video_frames_
.push_back(frame
);
505 DCHECK(!ready_video_frames_
.empty());
507 if (pending_decode_cb_
.is_null())
510 base::ResetAndReturn(&pending_decode_cb_
)
511 .Run(kOk
, ready_video_frames_
.front());
512 ready_video_frames_
.pop_front();
515 void GpuVideoDecoder::ReusePictureBuffer(
516 int64 picture_buffer_id
,
517 scoped_ptr
<gpu::MailboxHolder
> mailbox_holder
) {
518 DVLOG(3) << "ReusePictureBuffer(" << picture_buffer_id
<< ")";
519 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
524 CHECK(!picture_buffers_at_display_
.empty());
526 size_t num_erased
= picture_buffers_at_display_
.erase(picture_buffer_id
);
529 PictureBufferMap::iterator it
=
530 assigned_picture_buffers_
.find(picture_buffer_id
);
532 if (it
== assigned_picture_buffers_
.end()) {
533 // This picture was dismissed while in display, so we postponed deletion.
534 it
= dismissed_picture_buffers_
.find(picture_buffer_id
);
535 DCHECK(it
!= dismissed_picture_buffers_
.end());
536 factories_
->DeleteTexture(it
->second
.texture_id());
537 dismissed_picture_buffers_
.erase(it
);
541 factories_
->WaitSyncPoint(mailbox_holder
->sync_point
);
542 ++available_pictures_
;
544 vda_
->ReusePictureBuffer(picture_buffer_id
);
547 GpuVideoDecoder::SHMBuffer
* GpuVideoDecoder::GetSHM(size_t min_size
) {
548 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
549 if (available_shm_segments_
.empty() ||
550 available_shm_segments_
.back()->size
< min_size
) {
551 size_t size_to_allocate
= std::max(min_size
, kSharedMemorySegmentBytes
);
552 base::SharedMemory
* shm
= factories_
->CreateSharedMemory(size_to_allocate
);
553 // CreateSharedMemory() can return NULL during Shutdown.
556 return new SHMBuffer(shm
, size_to_allocate
);
558 SHMBuffer
* ret
= available_shm_segments_
.back();
559 available_shm_segments_
.pop_back();
563 void GpuVideoDecoder::PutSHM(SHMBuffer
* shm_buffer
) {
564 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
565 available_shm_segments_
.push_back(shm_buffer
);
568 void GpuVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id
) {
569 DVLOG(3) << "NotifyEndOfBitstreamBuffer(" << id
<< ")";
570 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
572 std::map
<int32
, BufferPair
>::iterator it
=
573 bitstream_buffers_in_decoder_
.find(id
);
574 if (it
== bitstream_buffers_in_decoder_
.end()) {
575 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE
);
576 NOTREACHED() << "Missing bitstream buffer: " << id
;
580 PutSHM(it
->second
.shm_buffer
);
581 bitstream_buffers_in_decoder_
.erase(it
);
583 if (pending_reset_cb_
.is_null() && state_
!= kDrainingDecoder
&&
584 CanMoreDecodeWorkBeDone() && !pending_decode_cb_
.is_null()) {
585 base::ResetAndReturn(&pending_decode_cb_
).Run(kNotEnoughData
, NULL
);
589 GpuVideoDecoder::~GpuVideoDecoder() {
590 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
591 DCHECK(!vda_
.get()); // Stop should have been already called.
592 DCHECK(pending_decode_cb_
.is_null());
593 for (size_t i
= 0; i
< available_shm_segments_
.size(); ++i
) {
594 available_shm_segments_
[i
]->shm
->Close();
595 delete available_shm_segments_
[i
];
597 available_shm_segments_
.clear();
598 for (std::map
<int32
, BufferPair
>::iterator it
=
599 bitstream_buffers_in_decoder_
.begin();
600 it
!= bitstream_buffers_in_decoder_
.end(); ++it
) {
601 it
->second
.shm_buffer
->shm
->Close();
603 bitstream_buffers_in_decoder_
.clear();
605 DestroyPictureBuffers(&assigned_picture_buffers_
);
606 DestroyPictureBuffers(&dismissed_picture_buffers_
);
609 void GpuVideoDecoder::NotifyFlushDone() {
610 DVLOG(3) << "NotifyFlushDone()";
611 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
612 DCHECK_EQ(state_
, kDrainingDecoder
);
613 state_
= kDecoderDrained
;
614 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEOSFrame());
617 void GpuVideoDecoder::NotifyResetDone() {
618 DVLOG(3) << "NotifyResetDone()";
619 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
620 DCHECK(ready_video_frames_
.empty());
622 // This needs to happen after the Reset() on vda_ is done to ensure pictures
623 // delivered during the reset can find their time data.
624 input_buffer_data_
.clear();
626 if (!pending_reset_cb_
.is_null())
627 base::ResetAndReturn(&pending_reset_cb_
).Run();
629 if (!pending_decode_cb_
.is_null())
630 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEOSFrame());
633 void GpuVideoDecoder::NotifyError(media::VideoDecodeAccelerator::Error error
) {
634 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
638 DLOG(ERROR
) << "VDA Error: " << error
;
643 if (!pending_decode_cb_
.is_null()) {
644 base::ResetAndReturn(&pending_decode_cb_
).Run(kDecodeError
, NULL
);
649 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
651 DCHECK(factories_
->GetTaskRunner()->BelongsToCurrentThread());