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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
324 | 324 |
325 if (make_context_current_cb_.is_null() || get_gles2_decoder_cb_.is_null()) { | 325 if (make_context_current_cb_.is_null() || get_gles2_decoder_cb_.is_null()) { |
326 NOTREACHED() << "GL callbacks are required for this VDA"; | 326 NOTREACHED() << "GL callbacks are required for this VDA"; |
327 return false; | 327 return false; |
328 } | 328 } |
329 | 329 |
330 DCHECK(client); | 330 DCHECK(client); |
331 client_ = client; | 331 client_ = client; |
332 codec_config_ = new CodecConfig(); | 332 codec_config_ = new CodecConfig(); |
333 codec_config_->codec_ = VideoCodecProfileToVideoCodec(config.profile); | 333 codec_config_->codec_ = VideoCodecProfileToVideoCodec(config.profile); |
334 codec_config_->coded_size_ = config.coded_size; | |
334 is_encrypted_ = config.is_encrypted; | 335 is_encrypted_ = config.is_encrypted; |
335 | 336 |
336 bool profile_supported = codec_config_->codec_ == media::kCodecVP8 || | 337 bool profile_supported = codec_config_->codec_ == media::kCodecVP8 || |
337 codec_config_->codec_ == media::kCodecVP9 || | 338 codec_config_->codec_ == media::kCodecVP9 || |
338 codec_config_->codec_ == media::kCodecH264; | 339 codec_config_->codec_ == media::kCodecH264; |
339 | 340 |
340 // We signalled that we support deferred initialization, so see if the client | 341 // We signalled that we support deferred initialization, so see if the client |
341 // does also. | 342 // does also. |
342 deferred_initialization_pending_ = config.is_deferred_initialization_allowed; | 343 deferred_initialization_pending_ = config.is_deferred_initialization_allowed; |
343 | 344 |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
944 scoped_refptr<CodecConfig> codec_config) { | 945 scoped_refptr<CodecConfig> codec_config) { |
945 TRACE_EVENT0("media", "AVDA::ConfigureMediaCodec"); | 946 TRACE_EVENT0("media", "AVDA::ConfigureMediaCodec"); |
946 | 947 |
947 jobject media_crypto = codec_config->media_crypto_ | 948 jobject media_crypto = codec_config->media_crypto_ |
948 ? codec_config->media_crypto_->obj() | 949 ? codec_config->media_crypto_->obj() |
949 : nullptr; | 950 : nullptr; |
950 | 951 |
951 // |needs_protected_surface_| implies encrypted stream. | 952 // |needs_protected_surface_| implies encrypted stream. |
952 DCHECK(!codec_config->needs_protected_surface_ || media_crypto); | 953 DCHECK(!codec_config->needs_protected_surface_ || media_crypto); |
953 | 954 |
954 // Pass a dummy 320x240 canvas size and let the codec signal the real size | |
955 // when it's known from the bitstream. | |
956 return scoped_ptr<media::VideoCodecBridge>( | 955 return scoped_ptr<media::VideoCodecBridge>( |
957 media::VideoCodecBridge::CreateDecoder( | 956 media::VideoCodecBridge::CreateDecoder( |
958 codec_config->codec_, codec_config->needs_protected_surface_, | 957 codec_config->codec_, codec_config->needs_protected_surface_, |
959 gfx::Size(320, 240), codec_config->surface_.j_surface().obj(), | 958 gfx::Size(codec_config->coded_size_.width(), |
Tima Vaisburd
2016/04/07 18:50:01
nit: will passing |codec_config_->coded_size_| wor
liberato (no reviews please)
2016/04/07 20:46:28
indeed, thanks!
| |
960 media_crypto, false)); | 959 codec_config->coded_size_.height()), |
960 codec_config->surface_.j_surface().obj(), media_crypto, true)); | |
961 } | 961 } |
962 | 962 |
963 void AndroidVideoDecodeAccelerator::OnCodecConfigured( | 963 void AndroidVideoDecodeAccelerator::OnCodecConfigured( |
964 scoped_ptr<media::VideoCodecBridge> media_codec) { | 964 scoped_ptr<media::VideoCodecBridge> media_codec) { |
965 DCHECK(thread_checker_.CalledOnValidThread()); | 965 DCHECK(thread_checker_.CalledOnValidThread()); |
966 DCHECK_EQ(state_, WAITING_FOR_CODEC); | 966 DCHECK_EQ(state_, WAITING_FOR_CODEC); |
967 | 967 |
968 media_codec_ = std::move(media_codec); | 968 media_codec_ = std::move(media_codec); |
969 | 969 |
970 // Record one instance of the codec being initialized. | 970 // Record one instance of the codec being initialized. |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1314 media::VideoDecodeAccelerator::Capabilities:: | 1314 media::VideoDecodeAccelerator::Capabilities:: |
1315 SUPPORTS_EXTERNAL_OUTPUT_SURFACE | | 1315 SUPPORTS_EXTERNAL_OUTPUT_SURFACE | |
1316 media::VideoDecodeAccelerator::Capabilities:: | 1316 media::VideoDecodeAccelerator::Capabilities:: |
1317 SUPPORTS_DEFERRED_INITIALIZATION; | 1317 SUPPORTS_DEFERRED_INITIALIZATION; |
1318 } | 1318 } |
1319 | 1319 |
1320 return capabilities; | 1320 return capabilities; |
1321 } | 1321 } |
1322 | 1322 |
1323 } // namespace content | 1323 } // namespace content |
OLD | NEW |