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

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

Issue 2640573002: Remove WebMediaPlayerDelegate null checks (Closed)
Patch Set: Undo accidental delete of WMPI::delegate_ Created 3 years, 11 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/blink/webmediaplayer_impl.h ('k') | media/blink/webmediaplayer_impl_unittest.cc » ('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 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 BindToCurrentLoop(base::Bind(function, AsWeakPtr()))) 169 BindToCurrentLoop(base::Bind(function, AsWeakPtr())))
170 170
171 #define BIND_TO_RENDER_LOOP1(function, arg1) \ 171 #define BIND_TO_RENDER_LOOP1(function, arg1) \
172 (DCHECK(main_task_runner_->BelongsToCurrentThread()), \ 172 (DCHECK(main_task_runner_->BelongsToCurrentThread()), \
173 BindToCurrentLoop(base::Bind(function, AsWeakPtr(), arg1))) 173 BindToCurrentLoop(base::Bind(function, AsWeakPtr(), arg1)))
174 174
175 WebMediaPlayerImpl::WebMediaPlayerImpl( 175 WebMediaPlayerImpl::WebMediaPlayerImpl(
176 blink::WebLocalFrame* frame, 176 blink::WebLocalFrame* frame,
177 blink::WebMediaPlayerClient* client, 177 blink::WebMediaPlayerClient* client,
178 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, 178 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
179 base::WeakPtr<WebMediaPlayerDelegate> delegate, 179 WebMediaPlayerDelegate* delegate,
180 std::unique_ptr<RendererFactory> renderer_factory, 180 std::unique_ptr<RendererFactory> renderer_factory,
181 linked_ptr<UrlIndex> url_index, 181 linked_ptr<UrlIndex> url_index,
182 const WebMediaPlayerParams& params) 182 const WebMediaPlayerParams& params)
183 : frame_(frame), 183 : frame_(frame),
184 delegate_state_(DelegateState::GONE), 184 delegate_state_(DelegateState::GONE),
185 delegate_has_audio_(false), 185 delegate_has_audio_(false),
186 network_state_(WebMediaPlayer::NetworkStateEmpty), 186 network_state_(WebMediaPlayer::NetworkStateEmpty),
187 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), 187 ready_state_(WebMediaPlayer::ReadyStateHaveNothing),
188 highest_ready_state_(WebMediaPlayer::ReadyStateHaveNothing), 188 highest_ready_state_(WebMediaPlayer::ReadyStateHaveNothing),
189 preload_(MultibufferDataSource::AUTO), 189 preload_(MultibufferDataSource::AUTO),
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 suppress_destruction_errors_(false), 240 suppress_destruction_errors_(false),
241 can_suspend_state_(CanSuspendState::UNKNOWN), 241 can_suspend_state_(CanSuspendState::UNKNOWN),
242 use_fallback_path_(false), 242 use_fallback_path_(false),
243 is_encrypted_(false), 243 is_encrypted_(false),
244 underflow_count_(0), 244 underflow_count_(0),
245 preroll_attempt_pending_(false), 245 preroll_attempt_pending_(false),
246 observer_(params.media_observer()) { 246 observer_(params.media_observer()) {
247 DCHECK(!adjust_allocated_memory_cb_.is_null()); 247 DCHECK(!adjust_allocated_memory_cb_.is_null());
248 DCHECK(renderer_factory_); 248 DCHECK(renderer_factory_);
249 DCHECK(client_); 249 DCHECK(client_);
250 DCHECK(delegate_);
250 251
251 tick_clock_.reset(new base::DefaultTickClock()); 252 tick_clock_.reset(new base::DefaultTickClock());
252 253
253 force_video_overlays_ = base::CommandLine::ForCurrentProcess()->HasSwitch( 254 force_video_overlays_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
254 switches::kForceVideoOverlays); 255 switches::kForceVideoOverlays);
255 256
256 enable_fullscreen_video_overlays_ = 257 enable_fullscreen_video_overlays_ =
257 base::FeatureList::IsEnabled(media::kOverlayFullscreenVideo); 258 base::FeatureList::IsEnabled(media::kOverlayFullscreenVideo);
258 259
259 if (delegate_) { 260 delegate_id_ = delegate_->AddObserver(this);
260 delegate_id_ = delegate_->AddObserver(this); 261 delegate_->SetIdle(delegate_id_, true);
261 delegate_->SetIdle(delegate_id_, true);
262 }
263 262
264 media_log_->AddEvent( 263 media_log_->AddEvent(
265 media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_CREATED)); 264 media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_CREATED));
266 265
267 if (params.initial_cdm()) 266 if (params.initial_cdm())
268 SetCdm(params.initial_cdm()); 267 SetCdm(params.initial_cdm());
269 268
270 // TODO(xhwang): When we use an external Renderer, many methods won't work, 269 // TODO(xhwang): When we use an external Renderer, many methods won't work,
271 // e.g. GetCurrentFrameFromCompositor(). See http://crbug.com/434861 270 // e.g. GetCurrentFrameFromCompositor(). See http://crbug.com/434861
272 audio_source_provider_ = 271 audio_source_provider_ =
273 new WebAudioSourceProviderImpl(params.audio_renderer_sink(), media_log_); 272 new WebAudioSourceProviderImpl(params.audio_renderer_sink(), media_log_);
274 } 273 }
275 274
276 WebMediaPlayerImpl::~WebMediaPlayerImpl() { 275 WebMediaPlayerImpl::~WebMediaPlayerImpl() {
277 DCHECK(main_task_runner_->BelongsToCurrentThread()); 276 DCHECK(main_task_runner_->BelongsToCurrentThread());
278 277
279 suppress_destruction_errors_ = true; 278 suppress_destruction_errors_ = true;
280 if (delegate_) { 279
281 delegate_->PlayerGone(delegate_id_); 280 delegate_->PlayerGone(delegate_id_);
282 delegate_->RemoveObserver(delegate_id_); 281 delegate_->RemoveObserver(delegate_id_);
283 }
284 282
285 // Finalize any watch time metrics before destroying the pipeline. 283 // Finalize any watch time metrics before destroying the pipeline.
286 watch_time_reporter_.reset(); 284 watch_time_reporter_.reset();
287 285
288 // Pipeline must be stopped before it is destroyed. 286 // Pipeline must be stopped before it is destroyed.
289 pipeline_.Stop(); 287 pipeline_.Stop();
290 288
291 if (last_reported_memory_usage_) 289 if (last_reported_memory_usage_)
292 adjust_allocated_memory_cb_.Run(-last_reported_memory_usage_); 290 adjust_allocated_memory_cb_.Run(-last_reported_memory_usage_);
293 291
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 DVLOG(1) << __func__; 418 DVLOG(1) << __func__;
421 DCHECK(main_task_runner_->BelongsToCurrentThread()); 419 DCHECK(main_task_runner_->BelongsToCurrentThread());
422 420
423 #if defined(OS_ANDROID) // WMPI_CAST 421 #if defined(OS_ANDROID) // WMPI_CAST
424 if (isRemote()) { 422 if (isRemote()) {
425 cast_impl_.play(); 423 cast_impl_.play();
426 return; 424 return;
427 } 425 }
428 #endif 426 #endif
429 // TODO(sandersd): Do we want to reset the idle timer here? 427 // TODO(sandersd): Do we want to reset the idle timer here?
430 if (delegate_) 428 delegate_->SetIdle(delegate_id_, false);
431 delegate_->SetIdle(delegate_id_, false);
432 paused_ = false; 429 paused_ = false;
433 pipeline_.SetPlaybackRate(playback_rate_); 430 pipeline_.SetPlaybackRate(playback_rate_);
434 background_pause_timer_.Stop(); 431 background_pause_timer_.Stop();
435 432
436 if (data_source_) 433 if (data_source_)
437 data_source_->MediaIsPlaying(); 434 data_source_->MediaIsPlaying();
438 435
439 if (observer_) 436 if (observer_)
440 observer_->OnPlaying(); 437 observer_->OnPlaying();
441 438
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 return; 525 return;
529 } 526 }
530 527
531 // Call this before setting |seeking_| so that the current media time can be 528 // Call this before setting |seeking_| so that the current media time can be
532 // recorded by the reporter. 529 // recorded by the reporter.
533 if (watch_time_reporter_) 530 if (watch_time_reporter_)
534 watch_time_reporter_->OnSeeking(); 531 watch_time_reporter_->OnSeeking();
535 532
536 // TODO(sandersd): Move |seeking_| to PipelineController. 533 // TODO(sandersd): Move |seeking_| to PipelineController.
537 // TODO(sandersd): Do we want to reset the idle timer here? 534 // TODO(sandersd): Do we want to reset the idle timer here?
538 if (delegate_) 535 delegate_->SetIdle(delegate_id_, false);
539 delegate_->SetIdle(delegate_id_, false);
540 ended_ = false; 536 ended_ = false;
541 seeking_ = true; 537 seeking_ = true;
542 seek_time_ = time; 538 seek_time_ = time;
543 if (paused_) 539 if (paused_)
544 paused_time_ = time; 540 paused_time_ = time;
545 pipeline_controller_.Seek(time, time_updated); 541 pipeline_controller_.Seek(time, time_updated);
546 542
547 // This needs to be called after Seek() so that if a resume is triggered, it 543 // This needs to be called after Seek() so that if a resume is triggered, it
548 // is to the correct time. 544 // is to the correct time.
549 UpdatePlayState(); 545 UpdatePlayState();
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 highest_ready_state_ < ReadyState::ReadyStateHaveFutureData) { 845 highest_ready_state_ < ReadyState::ReadyStateHaveFutureData) {
850 // Reset the preroll attempt clock. 846 // Reset the preroll attempt clock.
851 preroll_attempt_pending_ = true; 847 preroll_attempt_pending_ = true;
852 preroll_attempt_start_time_ = base::TimeTicks(); 848 preroll_attempt_start_time_ = base::TimeTicks();
853 849
854 // Clear any 'stale' flag and give the pipeline a chance to resume. If we 850 // Clear any 'stale' flag and give the pipeline a chance to resume. If we
855 // are already resumed, this will cause |preroll_attempt_start_time_| to be 851 // are already resumed, this will cause |preroll_attempt_start_time_| to be
856 // set. 852 // set.
857 // TODO(sandersd): Should this be on the same stack? It might be surprising 853 // TODO(sandersd): Should this be on the same stack? It might be surprising
858 // that didLoadingProgress() can synchronously change state. 854 // that didLoadingProgress() can synchronously change state.
859 if (delegate_) 855 delegate_->ClearStaleFlag(delegate_id_);
860 delegate_->ClearStaleFlag(delegate_id_);
861 UpdatePlayState(); 856 UpdatePlayState();
862 } 857 }
863 858
864 return did_loading_progress; 859 return did_loading_progress;
865 } 860 }
866 861
867 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, 862 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas,
868 const blink::WebRect& rect, 863 const blink::WebRect& rect,
869 SkPaint& paint) { 864 SkPaint& paint) {
870 DCHECK(main_task_runner_->BelongsToCurrentThread()); 865 DCHECK(main_task_runner_->BelongsToCurrentThread());
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 EnableVideoTrackIfNeeded(); 1458 EnableVideoTrackIfNeeded();
1464 1459
1465 UpdatePlayState(); 1460 UpdatePlayState();
1466 } 1461 }
1467 1462
1468 void WebMediaPlayerImpl::OnIdleTimeout() { 1463 void WebMediaPlayerImpl::OnIdleTimeout() {
1469 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1464 DCHECK(main_task_runner_->BelongsToCurrentThread());
1470 1465
1471 // If we are attempting preroll, clear the stale flag. 1466 // If we are attempting preroll, clear the stale flag.
1472 if (IsPrerollAttemptNeeded()) { 1467 if (IsPrerollAttemptNeeded()) {
1473 if (delegate_) 1468 delegate_->ClearStaleFlag(delegate_id_);
1474 delegate_->ClearStaleFlag(delegate_id_);
1475 return; 1469 return;
1476 } 1470 }
1477 1471
1478 UpdatePlayState(); 1472 UpdatePlayState();
1479 } 1473 }
1480 1474
1481 void WebMediaPlayerImpl::OnPlay() { 1475 void WebMediaPlayerImpl::OnPlay() {
1482 play(); 1476 play();
1483 client_->playbackStateChanged(); 1477 client_->playbackStateChanged();
1484 } 1478 }
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1812 bool is_backgrounded = IsBackgroundedSuspendEnabled() && IsHidden(); 1806 bool is_backgrounded = IsBackgroundedSuspendEnabled() && IsHidden();
1813 PlayState state = UpdatePlayState_ComputePlayState( 1807 PlayState state = UpdatePlayState_ComputePlayState(
1814 is_remote, is_streaming, is_suspended, is_backgrounded); 1808 is_remote, is_streaming, is_suspended, is_backgrounded);
1815 SetDelegateState(state.delegate_state, state.is_idle); 1809 SetDelegateState(state.delegate_state, state.is_idle);
1816 SetMemoryReportingState(state.is_memory_reporting_enabled); 1810 SetMemoryReportingState(state.is_memory_reporting_enabled);
1817 SetSuspendState(state.is_suspended || pending_suspend_resume_cycle_); 1811 SetSuspendState(state.is_suspended || pending_suspend_resume_cycle_);
1818 } 1812 }
1819 1813
1820 void WebMediaPlayerImpl::SetDelegateState(DelegateState new_state, 1814 void WebMediaPlayerImpl::SetDelegateState(DelegateState new_state,
1821 bool is_idle) { 1815 bool is_idle) {
1822 if (!delegate_) 1816 DCHECK(delegate_);
1823 return;
1824 1817
1825 // Prevent duplicate delegate calls. 1818 // Prevent duplicate delegate calls.
1826 // TODO(sandersd): Move this deduplication into the delegate itself. 1819 // TODO(sandersd): Move this deduplication into the delegate itself.
1827 // TODO(sandersd): WebContentsObserverSanityChecker does not allow sending the 1820 // TODO(sandersd): WebContentsObserverSanityChecker does not allow sending the
1828 // 'playing' IPC more than once in a row, even if the metadata has changed. 1821 // 'playing' IPC more than once in a row, even if the metadata has changed.
1829 // Figure out whether it should. 1822 // Figure out whether it should.
1830 bool has_audio = hasAudio() && !client_->isAutoplayingMuted(); 1823 bool has_audio = hasAudio() && !client_->isAutoplayingMuted();
1831 if (delegate_state_ == new_state && 1824 if (delegate_state_ == new_state &&
1832 (delegate_state_ != DelegateState::PLAYING || 1825 (delegate_state_ != DelegateState::PLAYING ||
1833 delegate_has_audio_ == has_audio)) { 1826 delegate_has_audio_ == has_audio)) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 } 1908 }
1916 } 1909 }
1917 1910
1918 WebMediaPlayerImpl::PlayState 1911 WebMediaPlayerImpl::PlayState
1919 WebMediaPlayerImpl::UpdatePlayState_ComputePlayState(bool is_remote, 1912 WebMediaPlayerImpl::UpdatePlayState_ComputePlayState(bool is_remote,
1920 bool is_streaming, 1913 bool is_streaming,
1921 bool is_suspended, 1914 bool is_suspended,
1922 bool is_backgrounded) { 1915 bool is_backgrounded) {
1923 PlayState result; 1916 PlayState result;
1924 1917
1925 bool must_suspend = delegate_ && delegate_->IsFrameClosed(); 1918 bool must_suspend = delegate_->IsFrameClosed();
1926 bool is_stale = delegate_ && delegate_->IsStale(delegate_id_); 1919 bool is_stale = delegate_->IsStale(delegate_id_);
1927 1920
1928 // This includes both data source (before pipeline startup) and pipeline 1921 // This includes both data source (before pipeline startup) and pipeline
1929 // errors. 1922 // errors.
1930 bool has_error = IsNetworkStateError(network_state_); 1923 bool has_error = IsNetworkStateError(network_state_);
1931 1924
1932 // After HaveMetadata, we know which tracks are present and the duration. 1925 // After HaveMetadata, we know which tracks are present and the duration.
1933 bool have_metadata = ready_state_ >= WebMediaPlayer::ReadyStateHaveMetadata; 1926 bool have_metadata = ready_state_ >= WebMediaPlayer::ReadyStateHaveMetadata;
1934 1927
1935 // After HaveFutureData, Blink will call play() if the state is not paused; 1928 // After HaveFutureData, Blink will call play() if the state is not paused;
1936 // prior to this point |paused_| is not accurate. 1929 // prior to this point |paused_| is not accurate.
1937 bool have_future_data = 1930 bool have_future_data =
1938 highest_ready_state_ >= WebMediaPlayer::ReadyStateHaveFutureData; 1931 highest_ready_state_ >= WebMediaPlayer::ReadyStateHaveFutureData;
1939 1932
1940 // Background suspend is not enabled for audio-only players unless paused, 1933 // Background suspend is not enabled for audio-only players unless paused,
1941 // though in the case of audio-only the session should be kept. 1934 // though in the case of audio-only the session should be kept.
1942 // Videos are not suspended if the user resumed the playback via the remote 1935 // Videos are not suspended if the user resumed the playback via the remote
1943 // controls earlier and it's still playing. 1936 // controls earlier and it's still playing.
1944 bool is_backgrounded_video = is_backgrounded && have_metadata && hasVideo(); 1937 bool is_backgrounded_video = is_backgrounded && have_metadata && hasVideo();
1945 bool can_play_backgrounded = is_backgrounded_video && !is_remote && 1938 bool can_play_backgrounded = is_backgrounded_video && !is_remote &&
1946 hasAudio() && IsResumeBackgroundVideosEnabled(); 1939 hasAudio() && IsResumeBackgroundVideosEnabled();
1947 bool is_background_playing = 1940 bool is_background_playing = delegate_->IsBackgroundVideoPlaybackUnlocked();
1948 delegate_ && delegate_->IsBackgroundVideoPlaybackUnlocked();
1949 bool background_suspended = !is_streaming && is_backgrounded_video && 1941 bool background_suspended = !is_streaming && is_backgrounded_video &&
1950 !(can_play_backgrounded && is_background_playing); 1942 !(can_play_backgrounded && is_background_playing);
1951 bool background_pause_suspended = 1943 bool background_pause_suspended =
1952 !is_streaming && is_backgrounded && paused_ && have_future_data; 1944 !is_streaming && is_backgrounded && paused_ && have_future_data;
1953 1945
1954 // Idle suspension is allowed prior to have future data since there exist 1946 // Idle suspension is allowed prior to have future data since there exist
1955 // mechanisms to exit the idle state when the player is capable of reaching 1947 // mechanisms to exit the idle state when the player is capable of reaching
1956 // the have future data state; see didLoadingProgress(). 1948 // the have future data state; see didLoadingProgress().
1957 // 1949 //
1958 // TODO(sandersd): Make the delegate suspend idle players immediately when 1950 // TODO(sandersd): Make the delegate suspend idle players immediately when
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 // |has_session_suspended| means the player is suspended from the media 1988 // |has_session_suspended| means the player is suspended from the media
1997 // element point of view but paused and can be resumed from the delegate point 1989 // element point of view but paused and can be resumed from the delegate point
1998 // of view. Therefore it behaves like |paused_| for the delegate. 1990 // of view. Therefore it behaves like |paused_| for the delegate.
1999 bool has_session_suspended = can_play && !must_suspend && 1991 bool has_session_suspended = can_play && !must_suspend &&
2000 background_suspended && can_play_backgrounded; 1992 background_suspended && can_play_backgrounded;
2001 1993
2002 bool has_session = has_session_playing || has_session_suspended; 1994 bool has_session = has_session_playing || has_session_suspended;
2003 1995
2004 if (!has_session) { 1996 if (!has_session) {
2005 result.delegate_state = DelegateState::GONE; 1997 result.delegate_state = DelegateState::GONE;
2006 result.is_idle = delegate_ && delegate_->IsIdle(delegate_id_); 1998 result.is_idle = delegate_->IsIdle(delegate_id_);
2007 } else if (paused_ || has_session_suspended) { 1999 } else if (paused_ || has_session_suspended) {
2008 // TODO(sandersd): Is it possible to have a suspended session, be ended, 2000 // TODO(sandersd): Is it possible to have a suspended session, be ended,
2009 // and not be paused? If so we should be in a PLAYING state. 2001 // and not be paused? If so we should be in a PLAYING state.
2010 result.delegate_state = 2002 result.delegate_state =
2011 ended_ ? DelegateState::GONE : DelegateState::PAUSED; 2003 ended_ ? DelegateState::GONE : DelegateState::PAUSED;
2012 result.is_idle = !seeking_; 2004 result.is_idle = !seeking_;
2013 } else { 2005 } else {
2014 result.delegate_state = DelegateState::PLAYING; 2006 result.delegate_state = DelegateState::PLAYING;
2015 result.is_idle = false; 2007 result.is_idle = false;
2016 } 2008 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 this, &WebMediaPlayerImpl::OnPause); 2089 this, &WebMediaPlayerImpl::OnPause);
2098 } 2090 }
2099 2091
2100 void WebMediaPlayerImpl::CreateWatchTimeReporter() { 2092 void WebMediaPlayerImpl::CreateWatchTimeReporter() {
2101 // Create the watch time reporter and synchronize its initial state. 2093 // Create the watch time reporter and synchronize its initial state.
2102 watch_time_reporter_.reset(new WatchTimeReporter( 2094 watch_time_reporter_.reset(new WatchTimeReporter(
2103 hasAudio(), hasVideo(), !!chunk_demuxer_, is_encrypted_, media_log_, 2095 hasAudio(), hasVideo(), !!chunk_demuxer_, is_encrypted_, media_log_,
2104 pipeline_metadata_.natural_size, 2096 pipeline_metadata_.natural_size,
2105 base::Bind(&GetCurrentTimeInternal, this))); 2097 base::Bind(&GetCurrentTimeInternal, this)));
2106 watch_time_reporter_->OnVolumeChange(volume_); 2098 watch_time_reporter_->OnVolumeChange(volume_);
2107 if (delegate_ && delegate_->IsFrameHidden()) 2099 if (delegate_->IsFrameHidden())
2108 watch_time_reporter_->OnHidden(); 2100 watch_time_reporter_->OnHidden();
2109 else 2101 else
2110 watch_time_reporter_->OnShown(); 2102 watch_time_reporter_->OnShown();
2111 } 2103 }
2112 2104
2113 bool WebMediaPlayerImpl::IsHidden() const { 2105 bool WebMediaPlayerImpl::IsHidden() const {
2114 DCHECK(main_task_runner_->BelongsToCurrentThread()); 2106 DCHECK(main_task_runner_->BelongsToCurrentThread());
2115 2107
2116 return delegate_ && delegate_->IsFrameHidden() && !delegate_->IsFrameClosed(); 2108 return delegate_->IsFrameHidden() && !delegate_->IsFrameClosed();
2117 } 2109 }
2118 2110
2119 bool WebMediaPlayerImpl::IsStreaming() const { 2111 bool WebMediaPlayerImpl::IsStreaming() const {
2120 return data_source_ && data_source_->IsStreaming(); 2112 return data_source_ && data_source_->IsStreaming();
2121 } 2113 }
2122 2114
2123 bool WebMediaPlayerImpl::DoesOverlaySupportMetadata() const { 2115 bool WebMediaPlayerImpl::DoesOverlaySupportMetadata() const {
2124 return pipeline_metadata_.video_rotation == VIDEO_ROTATION_0; 2116 return pipeline_metadata_.video_rotation == VIDEO_ROTATION_0;
2125 } 2117 }
2126 2118
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 UMA_HISTOGRAM_TIMES( 2227 UMA_HISTOGRAM_TIMES(
2236 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack", 2228 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack",
2237 time_to_first_frame); 2229 time_to_first_frame);
2238 } else { 2230 } else {
2239 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused", 2231 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused",
2240 time_to_first_frame); 2232 time_to_first_frame);
2241 } 2233 }
2242 } 2234 }
2243 2235
2244 } // namespace media 2236 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/blink/webmediaplayer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698