| 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 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 weak_this_factory_.GetWeakPtr(), bitstream_buffer_id)); | 1236 weak_this_factory_.GetWeakPtr(), bitstream_buffer_id)); |
| 1237 } | 1237 } |
| 1238 } | 1238 } |
| 1239 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", 0); | 1239 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", 0); |
| 1240 bitstreams_notified_in_advance_.clear(); | 1240 bitstreams_notified_in_advance_.clear(); |
| 1241 | 1241 |
| 1242 picture_buffer_manager_.ReleaseCodecBuffers(output_picture_buffers_); | 1242 picture_buffer_manager_.ReleaseCodecBuffers(output_picture_buffers_); |
| 1243 StartCodecDrain(DRAIN_FOR_RESET); | 1243 StartCodecDrain(DRAIN_FOR_RESET); |
| 1244 } | 1244 } |
| 1245 | 1245 |
| 1246 void AndroidVideoDecodeAccelerator::SetSurface(int32_t surface_id) { | 1246 void AndroidVideoDecodeAccelerator::SetSurface( |
| 1247 int32_t surface_id, |
| 1248 const base::Optional<base::UnguessableToken>& routing_token) { |
| 1247 DVLOG(1) << __func__; | 1249 DVLOG(1) << __func__; |
| 1248 DCHECK(thread_checker_.CalledOnValidThread()); | 1250 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1249 | 1251 |
| 1250 // It's possible that we'll receive a SetSurface before initializing the | 1252 // It's possible that we'll receive a SetSurface before initializing the |
| 1251 // surface chooser. For example, if we defer surface creation, then we'll | 1253 // surface chooser. For example, if we defer surface creation, then we'll |
| 1252 // signal success to WMPI before initializing it. WMPI is free to change the | 1254 // signal success to WMPI before initializing it. WMPI is free to change the |
| 1253 // surface. In this case, just pretend that |surface_id| is the initial one. | 1255 // surface. In this case, just pretend that |surface_id| is the initial one. |
| 1254 if (state_ == BEFORE_OVERLAY_INIT) { | 1256 if (state_ == BEFORE_OVERLAY_INIT) { |
| 1255 config_.surface_id = surface_id; | 1257 config_.surface_id = surface_id; |
| 1256 return; | 1258 return; |
| 1257 } | 1259 } |
| 1258 | 1260 |
| 1259 AndroidOverlayFactoryCB factory; | 1261 AndroidOverlayFactoryCB factory; |
| 1260 if (surface_id != SurfaceManager::kNoSurfaceID) | 1262 if (routing_token) { |
| 1263 // TODO(liberato): do something |
| 1264 } else if (surface_id != SurfaceManager::kNoSurfaceID) { |
| 1261 factory = base::Bind(&CreateContentVideoViewOverlay, surface_id); | 1265 factory = base::Bind(&CreateContentVideoViewOverlay, surface_id); |
| 1266 } |
| 1262 | 1267 |
| 1263 surface_chooser_->ReplaceOverlayFactory(std::move(factory)); | 1268 surface_chooser_->ReplaceOverlayFactory(std::move(factory)); |
| 1264 } | 1269 } |
| 1265 | 1270 |
| 1266 void AndroidVideoDecodeAccelerator::Destroy() { | 1271 void AndroidVideoDecodeAccelerator::Destroy() { |
| 1267 DVLOG(1) << __func__; | 1272 DVLOG(1) << __func__; |
| 1268 DCHECK(thread_checker_.CalledOnValidThread()); | 1273 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1269 | 1274 |
| 1270 picture_buffer_manager_.Destroy(output_picture_buffers_); | 1275 picture_buffer_manager_.Destroy(output_picture_buffers_); |
| 1271 client_ = nullptr; | 1276 client_ = nullptr; |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 codec_allocator_->ReleaseMediaCodec(std::move(media_codec_), | 1685 codec_allocator_->ReleaseMediaCodec(std::move(media_codec_), |
| 1681 codec_config_->surface_bundle); | 1686 codec_config_->surface_bundle); |
| 1682 } | 1687 } |
| 1683 | 1688 |
| 1684 void AndroidVideoDecodeAccelerator::ReleaseCodecAndBundle() { | 1689 void AndroidVideoDecodeAccelerator::ReleaseCodecAndBundle() { |
| 1685 ReleaseCodec(); | 1690 ReleaseCodec(); |
| 1686 codec_config_->surface_bundle = nullptr; | 1691 codec_config_->surface_bundle = nullptr; |
| 1687 } | 1692 } |
| 1688 | 1693 |
| 1689 } // namespace media | 1694 } // namespace media |
| OLD | NEW |