OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 void GpuVideoDecodeAccelerator::OnSetCdm(int cdm_id) { | 487 void GpuVideoDecodeAccelerator::OnSetCdm(int cdm_id) { |
488 DCHECK(video_decode_accelerator_); | 488 DCHECK(video_decode_accelerator_); |
489 video_decode_accelerator_->SetCdm(cdm_id); | 489 video_decode_accelerator_->SetCdm(cdm_id); |
490 } | 490 } |
491 | 491 |
492 // Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is | 492 // Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is |
493 // true, otherwise on the main thread. | 493 // true, otherwise on the main thread. |
494 void GpuVideoDecodeAccelerator::OnDecode( | 494 void GpuVideoDecodeAccelerator::OnDecode( |
495 const AcceleratedVideoDecoderMsg_Decode_Params& params) { | 495 const AcceleratedVideoDecoderMsg_Decode_Params& params) { |
496 DCHECK(video_decode_accelerator_); | 496 DCHECK(video_decode_accelerator_); |
497 if (params.bitstream_buffer_id < 0) { | |
498 DLOG(ERROR) << "BitstreamBuffer id " << params.bitstream_buffer_id | |
499 << " out of range"; | |
500 if (child_task_runner_->BelongsToCurrentThread()) { | |
501 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); | |
502 } else { | |
503 child_task_runner_->PostTask( | |
504 FROM_HERE, | |
505 base::Bind(&GpuVideoDecodeAccelerator::NotifyError, | |
506 base::Unretained(this), | |
507 media::VideoDecodeAccelerator::INVALID_ARGUMENT)); | |
508 } | |
509 return; | |
510 } | |
511 | |
512 media::BitstreamBuffer bitstream_buffer(params.bitstream_buffer_id, | 497 media::BitstreamBuffer bitstream_buffer(params.bitstream_buffer_id, |
513 params.buffer_handle, params.size, | 498 params.buffer_handle, params.size, |
514 params.presentation_timestamp); | 499 params.presentation_timestamp); |
515 if (!params.key_id.empty()) { | 500 if (!params.key_id.empty()) { |
516 bitstream_buffer.SetDecryptConfig( | 501 bitstream_buffer.SetDecryptConfig( |
517 media::DecryptConfig(params.key_id, params.iv, params.subsamples)); | 502 media::DecryptConfig(params.key_id, params.iv, params.subsamples)); |
518 } | 503 } |
519 | 504 |
520 video_decode_accelerator_->Decode(bitstream_buffer); | 505 video_decode_accelerator_->Decode(bitstream_buffer); |
521 } | 506 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 uncleared_textures_.erase(it); | 622 uncleared_textures_.erase(it); |
638 } | 623 } |
639 | 624 |
640 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, | 625 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, |
641 bool succeeded) { | 626 bool succeeded) { |
642 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); | 627 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); |
643 Send(message); | 628 Send(message); |
644 } | 629 } |
645 | 630 |
646 } // namespace content | 631 } // namespace content |
OLD | NEW |