| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 profiles = VTVideoDecodeAccelerator::GetSupportedProfiles(); | 426 profiles = VTVideoDecodeAccelerator::GetSupportedProfiles(); |
| 427 #elif defined(OS_ANDROID) | 427 #elif defined(OS_ANDROID) |
| 428 profiles = AndroidVideoDecodeAccelerator::GetSupportedProfiles(); | 428 profiles = AndroidVideoDecodeAccelerator::GetSupportedProfiles(); |
| 429 #endif | 429 #endif |
| 430 return GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeProfiles(profiles); | 430 return GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeProfiles(profiles); |
| 431 } | 431 } |
| 432 | 432 |
| 433 // Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is | 433 // Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is |
| 434 // true, otherwise on the main thread. | 434 // true, otherwise on the main thread. |
| 435 void GpuVideoDecodeAccelerator::OnDecode( | 435 void GpuVideoDecodeAccelerator::OnDecode( |
| 436 base::SharedMemoryHandle handle, | 436 const AcceleratedVideoDecoderMsg_Decode_Params& params) { |
| 437 int32 id, | |
| 438 uint32 size, | |
| 439 base::TimeDelta presentation_timestamp) { | |
| 440 DCHECK(video_decode_accelerator_.get()); | 437 DCHECK(video_decode_accelerator_.get()); |
| 441 if (id < 0) { | 438 if (params.bitstream_buffer_id < 0) { |
| 442 DLOG(ERROR) << "BitstreamBuffer id " << id << " out of range"; | 439 DLOG(ERROR) << "BitstreamBuffer id " << params.bitstream_buffer_id |
| 440 << " out of range"; |
| 443 if (child_task_runner_->BelongsToCurrentThread()) { | 441 if (child_task_runner_->BelongsToCurrentThread()) { |
| 444 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); | 442 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); |
| 445 } else { | 443 } else { |
| 446 child_task_runner_->PostTask( | 444 child_task_runner_->PostTask( |
| 447 FROM_HERE, | 445 FROM_HERE, |
| 448 base::Bind(&GpuVideoDecodeAccelerator::NotifyError, | 446 base::Bind(&GpuVideoDecodeAccelerator::NotifyError, |
| 449 base::Unretained(this), | 447 base::Unretained(this), |
| 450 media::VideoDecodeAccelerator::INVALID_ARGUMENT)); | 448 media::VideoDecodeAccelerator::INVALID_ARGUMENT)); |
| 451 } | 449 } |
| 452 return; | 450 return; |
| 453 } | 451 } |
| 454 video_decode_accelerator_->Decode( | 452 |
| 455 media::BitstreamBuffer(id, handle, size, presentation_timestamp)); | 453 media::BitstreamBuffer bitstream_buffer(params.bitstream_buffer_id, |
| 454 params.buffer_handle, params.size, |
| 455 params.presentation_timestamp); |
| 456 if (!params.key_id.empty()) { |
| 457 bitstream_buffer.SetDecryptConfig( |
| 458 media::DecryptConfig(params.key_id, params.iv, params.subsamples)); |
| 459 } |
| 460 |
| 461 video_decode_accelerator_->Decode(bitstream_buffer); |
| 456 } | 462 } |
| 457 | 463 |
| 458 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( | 464 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( |
| 459 const std::vector<int32>& buffer_ids, | 465 const std::vector<int32>& buffer_ids, |
| 460 const std::vector<uint32>& texture_ids) { | 466 const std::vector<uint32>& texture_ids) { |
| 461 if (buffer_ids.size() != texture_ids.size()) { | 467 if (buffer_ids.size() != texture_ids.size()) { |
| 462 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); | 468 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); |
| 463 return; | 469 return; |
| 464 } | 470 } |
| 465 | 471 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 return stub_->channel()->Send(message); | 626 return stub_->channel()->Send(message); |
| 621 } | 627 } |
| 622 | 628 |
| 623 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, | 629 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, |
| 624 bool succeeded) { | 630 bool succeeded) { |
| 625 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); | 631 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); |
| 626 Send(message); | 632 Send(message); |
| 627 } | 633 } |
| 628 | 634 |
| 629 } // namespace content | 635 } // namespace content |
| OLD | NEW |