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

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

Issue 2892083002: Send enter / exit fullscreen signal to AVDA (Closed)
Patch Set: unit test Created 3 years, 7 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
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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 // If we have a surface request callback we should call it and complete 302 // If we have a surface request callback we should call it and complete
303 // initialization with the returned surface. 303 // initialization with the returned surface.
304 request_overlay_info_cb_.Run( 304 request_overlay_info_cb_.Run(
305 requires_restart_for_external_output_surface, 305 requires_restart_for_external_output_surface,
306 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::OnOverlayInfoAvailable, 306 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::OnOverlayInfoAvailable,
307 weak_factory_.GetWeakPtr()))); 307 weak_factory_.GetWeakPtr())));
308 return; 308 return;
309 } 309 }
310 310
311 // If external surfaces are not supported we can complete initialization now. 311 // If external surfaces are not supported we can complete initialization now.
312 CompleteInitialization(SurfaceManager::kNoSurfaceID, 312 CompleteInitialization(OverlayInfo());
313 base::UnguessableToken());
314 } 313 }
315 314
316 // OnOverlayInfoAvailable() might be called at any time between Initialize() and 315 // OnOverlayInfoAvailable() might be called at any time between Initialize() and
317 // ~GpuVideoDecoder() so we have to be careful to not make assumptions about 316 // ~GpuVideoDecoder() so we have to be careful to not make assumptions about
318 // the current state. 317 // the current state.
319 // At most one of |surface_id| and |token| should be provided. The other will 318 // At most one of |surface_id| and |token| should be provided. The other will
320 // be kNoSurfaceID or an empty token, respectively. 319 // be kNoSurfaceID or an empty token, respectively.
321 void GpuVideoDecoder::OnOverlayInfoAvailable( 320 void GpuVideoDecoder::OnOverlayInfoAvailable(const OverlayInfo& overlay_info) {
322 int surface_id,
323 const base::Optional<base::UnguessableToken>& token) {
324 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); 321 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
325 322
326 if (!vda_) 323 if (!vda_)
327 return; 324 return;
328 325
329 // If the VDA has not been initialized, we were waiting for the first surface 326 // If the VDA has not been initialized, we were waiting for the first surface
330 // so it can be passed to Initialize() via the config. We can't call 327 // so it can be passed to Initialize() via the config. We can't call
331 // SetSurface() before initializing because there is no remote VDA to handle 328 // SetSurface() before initializing because there is no remote VDA to handle
332 // the call yet. 329 // the call yet.
333 if (!vda_initialized_) { 330 if (!vda_initialized_) {
334 CompleteInitialization(surface_id, token); 331 CompleteInitialization(overlay_info);
335 return; 332 return;
336 } 333 }
337 334
338 // The VDA must be already initialized (or async initialization is in 335 // The VDA must be already initialized (or async initialization is in
339 // progress) so we can call SetSurface(). 336 // progress) so we can call SetSurface().
340 vda_->SetSurface(surface_id, token); 337 vda_->SetOverlayInfo(overlay_info);
341 } 338 }
342 339
343 void GpuVideoDecoder::CompleteInitialization( 340 void GpuVideoDecoder::CompleteInitialization(const OverlayInfo& overlay_info) {
344 int surface_id,
345 const base::Optional<base::UnguessableToken>& token) {
346 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); 341 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
347 DCHECK(vda_); 342 DCHECK(vda_);
348 DCHECK(!init_cb_.is_null()); 343 DCHECK(!init_cb_.is_null());
349 DCHECK(!vda_initialized_); 344 DCHECK(!vda_initialized_);
350 345
351 VideoDecodeAccelerator::Config vda_config; 346 VideoDecodeAccelerator::Config vda_config;
352 vda_config.profile = config_.profile(); 347 vda_config.profile = config_.profile();
353 vda_config.cdm_id = cdm_id_; 348 vda_config.cdm_id = cdm_id_;
354 vda_config.surface_id = surface_id; 349 vda_config.overlay_info = overlay_info;
355 vda_config.overlay_routing_token = token;
356 vda_config.encryption_scheme = config_.encryption_scheme(); 350 vda_config.encryption_scheme = config_.encryption_scheme();
357 vda_config.is_deferred_initialization_allowed = true; 351 vda_config.is_deferred_initialization_allowed = true;
358 vda_config.initial_expected_coded_size = config_.coded_size(); 352 vda_config.initial_expected_coded_size = config_.coded_size();
359 vda_config.color_space = config_.color_space_info(); 353 vda_config.color_space = config_.color_space_info();
360 354
361 #if defined(OS_ANDROID) && BUILDFLAG(USE_PROPRIETARY_CODECS) 355 #if defined(OS_ANDROID) && BUILDFLAG(USE_PROPRIETARY_CODECS)
362 // We pass the SPS and PPS on Android because it lets us initialize 356 // We pass the SPS and PPS on Android because it lets us initialize
363 // MediaCodec more reliably (http://crbug.com/649185). 357 // MediaCodec more reliably (http://crbug.com/649185).
364 if (config_.codec() == kCodecH264) 358 if (config_.codec() == kCodecH264)
365 ExtractSpsAndPps(config_.extra_data(), &vda_config.sps, &vda_config.pps); 359 ExtractSpsAndPps(config_.extra_data(), &vda_config.sps, &vda_config.pps);
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 } 894 }
901 return false; 895 return false;
902 } 896 }
903 897
904 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() 898 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
905 const { 899 const {
906 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); 900 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread());
907 } 901 }
908 902
909 } // namespace media 903 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698