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

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 2508053002: media: Do a TimedWait() for video surface teardown in AVDA (Closed)
Patch Set: Created 4 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 SetNetworkState(WebMediaPlayer::NetworkStateIdle); 1496 SetNetworkState(WebMediaPlayer::NetworkStateIdle);
1497 else if (is_downloading && network_state_ == WebMediaPlayer::NetworkStateIdle) 1497 else if (is_downloading && network_state_ == WebMediaPlayer::NetworkStateIdle)
1498 SetNetworkState(WebMediaPlayer::NetworkStateLoading); 1498 SetNetworkState(WebMediaPlayer::NetworkStateLoading);
1499 media_log_->AddEvent( 1499 media_log_->AddEvent(
1500 media_log_->CreateBooleanEvent( 1500 media_log_->CreateBooleanEvent(
1501 MediaLogEvent::NETWORK_ACTIVITY_SET, 1501 MediaLogEvent::NETWORK_ACTIVITY_SET,
1502 "is_downloading_data", is_downloading)); 1502 "is_downloading_data", is_downloading));
1503 } 1503 }
1504 1504
1505 void WebMediaPlayerImpl::OnSurfaceCreated(int surface_id) { 1505 void WebMediaPlayerImpl::OnSurfaceCreated(int surface_id) {
1506 DVLOG(1) << __func__;
1506 overlay_surface_id_ = surface_id; 1507 overlay_surface_id_ = surface_id;
1507 if (!set_surface_cb_.is_null()) { 1508 if (!set_surface_cb_.is_null()) {
1508 // If restart is required, the callback is one-shot only. 1509 // If restart is required, the callback is one-shot only.
1509 if (decoder_requires_restart_for_overlay_) 1510 if (decoder_requires_restart_for_overlay_)
1510 base::ResetAndReturn(&set_surface_cb_).Run(surface_id); 1511 base::ResetAndReturn(&set_surface_cb_).Run(surface_id);
1511 else 1512 else
1512 set_surface_cb_.Run(surface_id); 1513 set_surface_cb_.Run(surface_id);
1513 } 1514 }
1514 } 1515 }
1515 1516
1516 void WebMediaPlayerImpl::OnSurfaceRequested( 1517 void WebMediaPlayerImpl::OnSurfaceRequested(
1517 bool decoder_requires_restart_for_overlay, 1518 bool decoder_requires_restart_for_overlay,
1518 const SurfaceCreatedCB& set_surface_cb) { 1519 const SurfaceCreatedCB& set_surface_cb) {
1519 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1520 DCHECK(main_task_runner_->BelongsToCurrentThread());
1520 DCHECK(surface_manager_); 1521 DCHECK(surface_manager_);
1521 DCHECK(!use_fallback_path_); 1522 DCHECK(!use_fallback_path_);
1523 DVLOG(1) << __func__;
1522 1524
1523 // A null callback indicates that the decoder is going away. 1525 // A null callback indicates that the decoder is going away.
1524 if (set_surface_cb.is_null()) { 1526 if (set_surface_cb.is_null()) {
1525 decoder_requires_restart_for_overlay_ = false; 1527 decoder_requires_restart_for_overlay_ = false;
1526 set_surface_cb_.Reset(); 1528 set_surface_cb_.Reset();
1527 return; 1529 return;
1528 } 1530 }
1529 1531
1530 // If we get a surface request it means GpuVideoDecoder is initializing, so 1532 // If we get a surface request it means GpuVideoDecoder is initializing, so
1531 // until we get a null surface request, GVD is the active decoder. 1533 // until we get a null surface request, GVD is the active decoder.
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1951 pipeline_metadata_.natural_size, 1953 pipeline_metadata_.natural_size,
1952 base::Bind(&GetCurrentTimeInternal, this))); 1954 base::Bind(&GetCurrentTimeInternal, this)));
1953 watch_time_reporter_->OnVolumeChange(volume_); 1955 watch_time_reporter_->OnVolumeChange(volume_);
1954 if (delegate_ && delegate_->IsHidden()) 1956 if (delegate_ && delegate_->IsHidden())
1955 watch_time_reporter_->OnHidden(); 1957 watch_time_reporter_->OnHidden();
1956 else 1958 else
1957 watch_time_reporter_->OnShown(); 1959 watch_time_reporter_->OnShown();
1958 } 1960 }
1959 1961
1960 } // namespace media 1962 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698