| 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 "media/gpu/android_video_decode_accelerator.h" | 5 #include "media/gpu/android_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 AndroidVideoDecodeAccelerator::BitstreamRecord::~BitstreamRecord() {} | 302 AndroidVideoDecodeAccelerator::BitstreamRecord::~BitstreamRecord() {} |
| 303 | 303 |
| 304 AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator( | 304 AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator( |
| 305 const MakeGLContextCurrentCallback& make_context_current_cb, | 305 const MakeGLContextCurrentCallback& make_context_current_cb, |
| 306 const GetGLES2DecoderCallback& get_gles2_decoder_cb) | 306 const GetGLES2DecoderCallback& get_gles2_decoder_cb) |
| 307 : client_(NULL), | 307 : client_(NULL), |
| 308 make_context_current_cb_(make_context_current_cb), | 308 make_context_current_cb_(make_context_current_cb), |
| 309 get_gles2_decoder_cb_(get_gles2_decoder_cb), | 309 get_gles2_decoder_cb_(get_gles2_decoder_cb), |
| 310 state_(NO_ERROR), | 310 state_(NO_ERROR), |
| 311 picturebuffers_requested_(false), | 311 picturebuffers_requested_(false), |
| 312 picture_buffer_manager_(this), |
| 312 drain_type_(DRAIN_TYPE_NONE), | 313 drain_type_(DRAIN_TYPE_NONE), |
| 313 media_drm_bridge_cdm_context_(nullptr), | 314 media_drm_bridge_cdm_context_(nullptr), |
| 314 cdm_registration_id_(0), | 315 cdm_registration_id_(0), |
| 315 pending_input_buf_index_(-1), | 316 pending_input_buf_index_(-1), |
| 316 error_sequence_token_(0), | 317 error_sequence_token_(0), |
| 317 defer_errors_(false), | 318 defer_errors_(false), |
| 318 deferred_initialization_pending_(false), | 319 deferred_initialization_pending_(false), |
| 319 codec_needs_reset_(false), | 320 codec_needs_reset_(false), |
| 320 defer_surface_creation_(false), | 321 defer_surface_creation_(false), |
| 321 weak_this_factory_(this) {} | 322 weak_this_factory_(this) {} |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 } | 440 } |
| 440 } | 441 } |
| 441 | 442 |
| 442 bool AndroidVideoDecodeAccelerator::InitializePictureBufferManager() { | 443 bool AndroidVideoDecodeAccelerator::InitializePictureBufferManager() { |
| 443 if (!make_context_current_cb_.Run()) { | 444 if (!make_context_current_cb_.Run()) { |
| 444 LOG(ERROR) << "Failed to make this decoder's GL context current."; | 445 LOG(ERROR) << "Failed to make this decoder's GL context current."; |
| 445 return false; | 446 return false; |
| 446 } | 447 } |
| 447 | 448 |
| 448 codec_config_->surface_ = | 449 codec_config_->surface_ = |
| 449 picture_buffer_manager_.Initialize(this, config_.surface_id); | 450 picture_buffer_manager_.Initialize(config_.surface_id); |
| 450 if (codec_config_->surface_.IsEmpty()) | 451 if (codec_config_->surface_.IsEmpty()) |
| 451 return false; | 452 return false; |
| 452 | 453 |
| 453 on_destroying_surface_cb_ = | 454 on_destroying_surface_cb_ = |
| 454 base::Bind(&AndroidVideoDecodeAccelerator::OnDestroyingSurface, | 455 base::Bind(&AndroidVideoDecodeAccelerator::OnDestroyingSurface, |
| 455 weak_this_factory_.GetWeakPtr()); | 456 weak_this_factory_.GetWeakPtr()); |
| 456 AVDASurfaceTracker::GetInstance()->RegisterOnDestroyingSurfaceCallback( | 457 AVDASurfaceTracker::GetInstance()->RegisterOnDestroyingSurfaceCallback( |
| 457 on_destroying_surface_cb_); | 458 on_destroying_surface_cb_); |
| 458 | 459 |
| 459 if (!g_avda_codec_allocator.Get().StartThread(this)) | 460 if (!g_avda_codec_allocator.Get().StartThread(this)) |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 | 1578 |
| 1578 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() | 1579 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() |
| 1579 const { | 1580 const { |
| 1580 // Prevent MediaCodec from using its internal software decoders when we have | 1581 // Prevent MediaCodec from using its internal software decoders when we have |
| 1581 // more secure and up to date versions in the renderer process. | 1582 // more secure and up to date versions in the renderer process. |
| 1582 return !config_.is_encrypted && (codec_config_->codec_ == kCodecVP8 || | 1583 return !config_.is_encrypted && (codec_config_->codec_ == kCodecVP8 || |
| 1583 codec_config_->codec_ == kCodecVP9); | 1584 codec_config_->codec_ == kCodecVP9); |
| 1584 } | 1585 } |
| 1585 | 1586 |
| 1586 } // namespace media | 1587 } // namespace media |
| OLD | NEW |