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