| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/android_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
| 12 #include "content/common/gpu/gpu_channel.h" | 12 #include "content/common/gpu/gpu_channel.h" |
| 13 #include "content/common/gpu/media/avda_return_on_failure.h" | 13 #include "content/common/gpu/media/avda_return_on_failure.h" |
| 14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 15 #include "media/base/bitstream_buffer.h" | 15 #include "media/base/bitstream_buffer.h" |
| 16 #include "media/base/limits.h" | 16 #include "media/base/limits.h" |
| 17 #include "media/base/timestamp_constants.h" | 17 #include "media/base/timestamp_constants.h" |
| 18 #include "media/base/video_decoder_config.h" | 18 #include "media/base/video_decoder_config.h" |
| 19 #include "media/video/picture.h" | 19 #include "media/video/picture.h" |
| 20 #include "ui/gl/android/scoped_java_surface.h" | 20 #include "ui/gl/android/scoped_java_surface.h" |
| 21 #include "ui/gl/android/surface_texture.h" | 21 #include "ui/gl/android/surface_texture.h" |
| 22 #include "ui/gl/gl_bindings.h" | 22 #include "ui/gl/gl_bindings.h" |
| 23 | 23 |
| 24 #if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
| 25 #include "media/base/media_keys.h" |
| 26 #include "media/mojo/services/mojo_cdm_service.h" |
| 27 #endif |
| 28 |
| 24 namespace content { | 29 namespace content { |
| 25 | 30 |
| 26 // Max number of bitstreams notified to the client with | 31 // Max number of bitstreams notified to the client with |
| 27 // NotifyEndOfBitstreamBuffer() before getting output from the bitstream. | 32 // NotifyEndOfBitstreamBuffer() before getting output from the bitstream. |
| 28 enum { kMaxBitstreamsNotifiedInAdvance = 32 }; | 33 enum { kMaxBitstreamsNotifiedInAdvance = 32 }; |
| 29 | 34 |
| 30 #if defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID) | 35 #if defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID) |
| 31 // MediaCodec is only guaranteed to support baseline, but some devices may | 36 // MediaCodec is only guaranteed to support baseline, but some devices may |
| 32 // support others. Advertise support for all H264 profiles and let the | 37 // support others. Advertise support for all H264 profiles and let the |
| 33 // MediaCodec fail when decoding if it's not actually supported. It's assumed | 38 // MediaCodec fail when decoding if it's not actually supported. It's assumed |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 surface_texture_ = strategy_->CreateSurfaceTexture(); | 136 surface_texture_ = strategy_->CreateSurfaceTexture(); |
| 132 | 137 |
| 133 if (!ConfigureMediaCodec()) { | 138 if (!ConfigureMediaCodec()) { |
| 134 LOG(ERROR) << "Failed to create MediaCodec instance."; | 139 LOG(ERROR) << "Failed to create MediaCodec instance."; |
| 135 return false; | 140 return false; |
| 136 } | 141 } |
| 137 | 142 |
| 138 return true; | 143 return true; |
| 139 } | 144 } |
| 140 | 145 |
| 141 void AndroidVideoDecodeAccelerator::SetCdm(int /* cdm_id */) { | 146 void AndroidVideoDecodeAccelerator::SetCdm(int cdm_id) { |
| 142 // TODO(xhwang): Implement CDM setting here. | 147 DVLOG(2) << __FUNCTION__ << ": " << cdm_id; |
| 148 |
| 149 #if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
| 150 // TODO(timav): Implement CDM setting here. See http://crbug.com/542417 |
| 151 scoped_refptr<media::MediaKeys> cdm = media::MojoCdmService::GetCdm(cdm_id); |
| 152 DCHECK(cdm); |
| 153 #endif |
| 154 |
| 143 NOTIMPLEMENTED(); | 155 NOTIMPLEMENTED(); |
| 144 NotifyCdmAttached(false); | 156 NotifyCdmAttached(false); |
| 145 } | 157 } |
| 146 | 158 |
| 147 void AndroidVideoDecodeAccelerator::DoIOTask() { | 159 void AndroidVideoDecodeAccelerator::DoIOTask() { |
| 148 DCHECK(thread_checker_.CalledOnValidThread()); | 160 DCHECK(thread_checker_.CalledOnValidThread()); |
| 149 TRACE_EVENT0("media", "AVDA::DoIOTask"); | 161 TRACE_EVENT0("media", "AVDA::DoIOTask"); |
| 150 if (state_ == ERROR) { | 162 if (state_ == ERROR) { |
| 151 return; | 163 return; |
| 152 } | 164 } |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 // software fallback for H264 on Android anyway. | 661 // software fallback for H264 on Android anyway. |
| 650 profile.max_resolution.SetSize(3840, 2160); | 662 profile.max_resolution.SetSize(3840, 2160); |
| 651 profiles.push_back(profile); | 663 profiles.push_back(profile); |
| 652 } | 664 } |
| 653 #endif | 665 #endif |
| 654 | 666 |
| 655 return profiles; | 667 return profiles; |
| 656 } | 668 } |
| 657 | 669 |
| 658 } // namespace content | 670 } // namespace content |
| OLD | NEW |