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

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

Issue 2653553005: [Video] Fix DCHECK crash in PauseVideoIfHidden (Closed)
Patch Set: Added IsHidden() check 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 | « no previous file | no next file » | 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 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 if (video_weblayer_) 1398 if (video_weblayer_)
1399 video_weblayer_->layer()->SetContentsOpaque(opaque_); 1399 video_weblayer_->layer()->SetContentsOpaque(opaque_);
1400 } 1400 }
1401 1401
1402 void WebMediaPlayerImpl::OnFrameHidden() { 1402 void WebMediaPlayerImpl::OnFrameHidden() {
1403 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1403 DCHECK(main_task_runner_->BelongsToCurrentThread());
1404 1404
1405 if (watch_time_reporter_) 1405 if (watch_time_reporter_)
1406 watch_time_reporter_->OnHidden(); 1406 watch_time_reporter_->OnHidden();
1407 1407
1408 if (ShouldPauseVideoWhenHidden()) { 1408 // OnFrameHidden() can be called when frame is closed, then IsHidden() will
1409 PauseVideoIfNeeded(); 1409 // return false, so check explicitly.
1410 return; 1410 if (IsHidden()) {
1411 } else { 1411 if (ShouldPauseVideoWhenHidden()) {
1412 DisableVideoTrackIfNeeded(); 1412 PauseVideoIfNeeded();
1413 return;
1414 } else {
1415 DisableVideoTrackIfNeeded();
1416 }
1413 } 1417 }
1414 1418
1415 UpdatePlayState(); 1419 UpdatePlayState();
1416 1420
1417 // Schedule suspended playing media to be paused if the user doesn't come back 1421 // Schedule suspended playing media to be paused if the user doesn't come back
1418 // to it within some timeout period to avoid any autoplay surprises. 1422 // to it within some timeout period to avoid any autoplay surprises.
1419 ScheduleIdlePauseTimer(); 1423 ScheduleIdlePauseTimer();
1420 } 1424 }
1421 1425
1422 void WebMediaPlayerImpl::OnFrameClosed() { 1426 void WebMediaPlayerImpl::OnFrameClosed() {
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
2253 UMA_HISTOGRAM_TIMES( 2257 UMA_HISTOGRAM_TIMES(
2254 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack", 2258 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack",
2255 time_to_first_frame); 2259 time_to_first_frame);
2256 } else { 2260 } else {
2257 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused", 2261 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused",
2258 time_to_first_frame); 2262 time_to_first_frame);
2259 } 2263 }
2260 } 2264 }
2261 2265
2262 } // namespace media 2266 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698