Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: content/common/gpu/media/android_video_decode_accelerator.cc

Issue 1869103002: Enable adaptive playback for spitzer, use conservative size. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cl feedback. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_->initial_expected_coded_size_ =
335 config.initial_expected_coded_size;
334 is_encrypted_ = config.is_encrypted; 336 is_encrypted_ = config.is_encrypted;
335 337
336 bool profile_supported = codec_config_->codec_ == media::kCodecVP8 || 338 bool profile_supported = codec_config_->codec_ == media::kCodecVP8 ||
337 codec_config_->codec_ == media::kCodecVP9 || 339 codec_config_->codec_ == media::kCodecVP9 ||
338 codec_config_->codec_ == media::kCodecH264; 340 codec_config_->codec_ == media::kCodecH264;
339 341
340 // We signalled that we support deferred initialization, so see if the client 342 // We signalled that we support deferred initialization, so see if the client
341 // does also. 343 // does also.
342 deferred_initialization_pending_ = config.is_deferred_initialization_allowed; 344 deferred_initialization_pending_ = config.is_deferred_initialization_allowed;
343 345
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 scoped_refptr<CodecConfig> codec_config) { 946 scoped_refptr<CodecConfig> codec_config) {
945 TRACE_EVENT0("media", "AVDA::ConfigureMediaCodec"); 947 TRACE_EVENT0("media", "AVDA::ConfigureMediaCodec");
946 948
947 jobject media_crypto = codec_config->media_crypto_ 949 jobject media_crypto = codec_config->media_crypto_
948 ? codec_config->media_crypto_->obj() 950 ? codec_config->media_crypto_->obj()
949 : nullptr; 951 : nullptr;
950 952
951 // |needs_protected_surface_| implies encrypted stream. 953 // |needs_protected_surface_| implies encrypted stream.
952 DCHECK(!codec_config->needs_protected_surface_ || media_crypto); 954 DCHECK(!codec_config->needs_protected_surface_ || media_crypto);
953 955
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>( 956 return scoped_ptr<media::VideoCodecBridge>(
957 media::VideoCodecBridge::CreateDecoder( 957 media::VideoCodecBridge::CreateDecoder(
958 codec_config->codec_, codec_config->needs_protected_surface_, 958 codec_config->codec_, codec_config->needs_protected_surface_,
959 gfx::Size(320, 240), codec_config->surface_.j_surface().obj(), 959 codec_config->initial_expected_coded_size_,
960 media_crypto, false)); 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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698