Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Side by Side Diff: media/filters/gpu_video_decoder.cc

Issue 2892083002: Send enter / exit fullscreen signal to AVDA (Closed)
Patch Set: rebased. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/gpu/android_video_decode_accelerator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/filters/gpu_video_decoder.h" 5 #include "media/filters/gpu_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <array> 8 #include <array>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // If we have a surface request callback we should call it and complete 300 // If we have a surface request callback we should call it and complete
301 // initialization with the returned surface. 301 // initialization with the returned surface.
302 request_overlay_info_cb_.Run( 302 request_overlay_info_cb_.Run(
303 requires_restart_for_external_output_surface, 303 requires_restart_for_external_output_surface,
304 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::OnOverlayInfoAvailable, 304 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::OnOverlayInfoAvailable,
305 weak_factory_.GetWeakPtr()))); 305 weak_factory_.GetWeakPtr())));
306 return; 306 return;
307 } 307 }
308 308
309 // If external surfaces are not supported we can complete initialization now. 309 // If external surfaces are not supported we can complete initialization now.
310 CompleteInitialization(SurfaceManager::kNoSurfaceID, 310 CompleteInitialization(OverlayInfo());
311 base::UnguessableToken());
312 } 311 }
313 312
314 // OnOverlayInfoAvailable() might be called at any time between Initialize() and 313 // OnOverlayInfoAvailable() might be called at any time between Initialize() and
315 // ~GpuVideoDecoder() so we have to be careful to not make assumptions about 314 // ~GpuVideoDecoder() so we have to be careful to not make assumptions about
316 // the current state. 315 // the current state.
317 // At most one of |surface_id| and |token| should be provided. The other will 316 // At most one of |surface_id| and |token| should be provided. The other will
318 // be kNoSurfaceID or an empty token, respectively. 317 // be kNoSurfaceID or an empty token, respectively.
319 void GpuVideoDecoder::OnOverlayInfoAvailable( 318 void GpuVideoDecoder::OnOverlayInfoAvailable(const OverlayInfo& overlay_info) {
320 int surface_id,
321 const base::Optional<base::UnguessableToken>& token) {
322 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); 319 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
323 320
324 if (!vda_) 321 if (!vda_)
325 return; 322 return;
326 323
327 // If the VDA has not been initialized, we were waiting for the first surface 324 // If the VDA has not been initialized, we were waiting for the first surface
328 // so it can be passed to Initialize() via the config. We can't call 325 // so it can be passed to Initialize() via the config. We can't call
329 // SetSurface() before initializing because there is no remote VDA to handle 326 // SetSurface() before initializing because there is no remote VDA to handle
330 // the call yet. 327 // the call yet.
331 if (!vda_initialized_) { 328 if (!vda_initialized_) {
332 CompleteInitialization(surface_id, token); 329 CompleteInitialization(overlay_info);
333 return; 330 return;
334 } 331 }
335 332
336 // The VDA must be already initialized (or async initialization is in 333 // The VDA must be already initialized (or async initialization is in
337 // progress) so we can call SetSurface(). 334 // progress) so we can call SetSurface().
338 vda_->SetSurface(surface_id, token); 335 vda_->SetOverlayInfo(overlay_info);
339 } 336 }
340 337
341 void GpuVideoDecoder::CompleteInitialization( 338 void GpuVideoDecoder::CompleteInitialization(const OverlayInfo& overlay_info) {
342 int surface_id,
343 const base::Optional<base::UnguessableToken>& token) {
344 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); 339 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
345 DCHECK(vda_); 340 DCHECK(vda_);
346 DCHECK(!init_cb_.is_null()); 341 DCHECK(!init_cb_.is_null());
347 DCHECK(!vda_initialized_); 342 DCHECK(!vda_initialized_);
348 343
349 VideoDecodeAccelerator::Config vda_config; 344 VideoDecodeAccelerator::Config vda_config;
350 vda_config.profile = config_.profile(); 345 vda_config.profile = config_.profile();
351 vda_config.cdm_id = cdm_id_; 346 vda_config.cdm_id = cdm_id_;
352 vda_config.surface_id = surface_id; 347 vda_config.overlay_info = overlay_info;
353 vda_config.overlay_routing_token = token;
354 vda_config.encryption_scheme = config_.encryption_scheme(); 348 vda_config.encryption_scheme = config_.encryption_scheme();
355 vda_config.is_deferred_initialization_allowed = true; 349 vda_config.is_deferred_initialization_allowed = true;
356 vda_config.initial_expected_coded_size = config_.coded_size(); 350 vda_config.initial_expected_coded_size = config_.coded_size();
357 vda_config.color_space = config_.color_space_info(); 351 vda_config.color_space = config_.color_space_info();
358 352
359 #if defined(OS_ANDROID) && BUILDFLAG(USE_PROPRIETARY_CODECS) 353 #if defined(OS_ANDROID) && BUILDFLAG(USE_PROPRIETARY_CODECS)
360 // We pass the SPS and PPS on Android because it lets us initialize 354 // We pass the SPS and PPS on Android because it lets us initialize
361 // MediaCodec more reliably (http://crbug.com/649185). 355 // MediaCodec more reliably (http://crbug.com/649185).
362 if (config_.codec() == kCodecH264) 356 if (config_.codec() == kCodecH264)
363 ExtractSpsAndPps(config_.extra_data(), &vda_config.sps, &vda_config.pps); 357 ExtractSpsAndPps(config_.extra_data(), &vda_config.sps, &vda_config.pps);
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 } 885 }
892 return false; 886 return false;
893 } 887 }
894 888
895 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() 889 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
896 const { 890 const {
897 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); 891 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread());
898 } 892 }
899 893
900 } // namespace media 894 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/gpu/android_video_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698