| 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 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 weak_this_factory_.GetWeakPtr(), bitstream_buffer_id)); | 1255 weak_this_factory_.GetWeakPtr(), bitstream_buffer_id)); |
| 1256 } | 1256 } |
| 1257 } | 1257 } |
| 1258 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", 0); | 1258 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", 0); |
| 1259 bitstreams_notified_in_advance_.clear(); | 1259 bitstreams_notified_in_advance_.clear(); |
| 1260 | 1260 |
| 1261 picture_buffer_manager_.ReleaseCodecBuffers(output_picture_buffers_); | 1261 picture_buffer_manager_.ReleaseCodecBuffers(output_picture_buffers_); |
| 1262 StartCodecDrain(DRAIN_FOR_RESET); | 1262 StartCodecDrain(DRAIN_FOR_RESET); |
| 1263 } | 1263 } |
| 1264 | 1264 |
| 1265 void AndroidVideoDecodeAccelerator::SetSurface(int32_t surface_id) { | 1265 void AndroidVideoDecodeAccelerator::SetSurface( |
| 1266 int32_t surface_id, |
| 1267 const base::Optional<base::UnguessableToken>& routing_token) { |
| 1266 DVLOG(1) << __func__; | 1268 DVLOG(1) << __func__; |
| 1267 DCHECK(thread_checker_.CalledOnValidThread()); | 1269 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1268 | 1270 |
| 1269 // It's possible that we'll receive a SetSurface before initializing the | 1271 // It's possible that we'll receive a SetSurface before initializing the |
| 1270 // surface chooser. For example, if we defer surface creation, then we'll | 1272 // surface chooser. For example, if we defer surface creation, then we'll |
| 1271 // signal success to WMPI before initializing it. WMPI is free to change the | 1273 // signal success to WMPI before initializing it. WMPI is free to change the |
| 1272 // surface. In this case, just pretend that |surface_id| is the initial one. | 1274 // surface. In this case, just pretend that |surface_id| is the initial one. |
| 1273 if (state_ == BEFORE_OVERLAY_INIT) { | 1275 if (state_ == BEFORE_OVERLAY_INIT) { |
| 1274 config_.surface_id = surface_id; | 1276 config_.surface_id = surface_id; |
| 1275 return; | 1277 return; |
| 1276 } | 1278 } |
| 1277 | 1279 |
| 1278 AndroidOverlayFactoryCB factory; | 1280 AndroidOverlayFactoryCB factory; |
| 1279 if (surface_id != SurfaceManager::kNoSurfaceID) | 1281 if (routing_token) { |
| 1282 // TODO(liberato): do something |
| 1283 } else if (surface_id != SurfaceManager::kNoSurfaceID) { |
| 1280 factory = base::Bind(&CreateContentVideoViewOverlay, surface_id); | 1284 factory = base::Bind(&CreateContentVideoViewOverlay, surface_id); |
| 1285 } |
| 1281 | 1286 |
| 1282 surface_chooser_->ReplaceOverlayFactory(std::move(factory)); | 1287 surface_chooser_->ReplaceOverlayFactory(std::move(factory)); |
| 1283 } | 1288 } |
| 1284 | 1289 |
| 1285 void AndroidVideoDecodeAccelerator::Destroy() { | 1290 void AndroidVideoDecodeAccelerator::Destroy() { |
| 1286 DVLOG(1) << __func__; | 1291 DVLOG(1) << __func__; |
| 1287 DCHECK(thread_checker_.CalledOnValidThread()); | 1292 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1288 | 1293 |
| 1289 picture_buffer_manager_.Destroy(output_picture_buffers_); | 1294 picture_buffer_manager_.Destroy(output_picture_buffers_); |
| 1290 client_ = nullptr; | 1295 client_ = nullptr; |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 codec_config_->task_type, | 1705 codec_config_->task_type, |
| 1701 codec_config_->surface_bundle); | 1706 codec_config_->surface_bundle); |
| 1702 } | 1707 } |
| 1703 | 1708 |
| 1704 void AndroidVideoDecodeAccelerator::ReleaseCodecAndBundle() { | 1709 void AndroidVideoDecodeAccelerator::ReleaseCodecAndBundle() { |
| 1705 ReleaseCodec(); | 1710 ReleaseCodec(); |
| 1706 codec_config_->surface_bundle = nullptr; | 1711 codec_config_->surface_bundle = nullptr; |
| 1707 } | 1712 } |
| 1708 | 1713 |
| 1709 } // namespace media | 1714 } // namespace media |
| OLD | NEW |