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 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1233 // Postpone ResetCodecState() after the drain. | 1233 // Postpone ResetCodecState() after the drain. |
1234 StartCodecDrain(DRAIN_FOR_RESET); | 1234 StartCodecDrain(DRAIN_FOR_RESET); |
1235 } else { | 1235 } else { |
1236 ResetCodecState(); | 1236 ResetCodecState(); |
1237 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1237 base::ThreadTaskRunnerHandle::Get()->PostTask( |
1238 FROM_HERE, base::Bind(&AndroidVideoDecodeAccelerator::NotifyResetDone, | 1238 FROM_HERE, base::Bind(&AndroidVideoDecodeAccelerator::NotifyResetDone, |
1239 weak_this_factory_.GetWeakPtr())); | 1239 weak_this_factory_.GetWeakPtr())); |
1240 } | 1240 } |
1241 } | 1241 } |
1242 | 1242 |
1243 void AndroidVideoDecodeAccelerator::SetSurface(int surface_id) { | |
1244 config_.surface_id = surface_id; | |
1245 codec_config_->surface_ = picture_buffer_manager_.SetSurface(surface_id); | |
1246 if (media_codec_) | |
1247 media_codec_->SetSurface(codec_config_->surface_.j_surface().obj()); | |
1248 | |
1249 // TODO(dalecurtis): What to do about AllocateSurface()? | |
liberato (no reviews please)
2016/10/29 18:57:20
since we didn't restart, i think that there should
| |
1250 // TODO(dalecurtis): What to do about inflight configurations? | |
1251 } | |
1252 | |
1243 void AndroidVideoDecodeAccelerator::Destroy() { | 1253 void AndroidVideoDecodeAccelerator::Destroy() { |
1244 DVLOG(1) << __FUNCTION__; | 1254 DVLOG(1) << __FUNCTION__; |
1245 DCHECK(thread_checker_.CalledOnValidThread()); | 1255 DCHECK(thread_checker_.CalledOnValidThread()); |
1246 | 1256 |
1247 picture_buffer_manager_.Destroy(output_picture_buffers_); | 1257 picture_buffer_manager_.Destroy(output_picture_buffers_); |
1248 | 1258 |
1249 client_ = nullptr; | 1259 client_ = nullptr; |
1250 | 1260 |
1251 // Some VP8 files require a complete MediaCodec drain before we can call | 1261 // Some VP8 files require a complete MediaCodec drain before we can call |
1252 // MediaCodec.flush() or MediaCodec.release(). http://crbug.com/598963. In | 1262 // MediaCodec.flush() or MediaCodec.release(). http://crbug.com/598963. In |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1577 | 1587 |
1578 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() | 1588 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() |
1579 const { | 1589 const { |
1580 // Prevent MediaCodec from using its internal software decoders when we have | 1590 // Prevent MediaCodec from using its internal software decoders when we have |
1581 // more secure and up to date versions in the renderer process. | 1591 // more secure and up to date versions in the renderer process. |
1582 return !config_.is_encrypted && (codec_config_->codec_ == kCodecVP8 || | 1592 return !config_.is_encrypted && (codec_config_->codec_ == kCodecVP8 || |
1583 codec_config_->codec_ == kCodecVP9); | 1593 codec_config_->codec_ == kCodecVP9); |
1584 } | 1594 } |
1585 | 1595 |
1586 } // namespace media | 1596 } // namespace media |
OLD | NEW |