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

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

Issue 2666543003: [Video] Fix DCHECK crash in PauseVideoIfHidden (Closed)
Patch Set: Created 3 years, 10 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 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 if (video_weblayer_) 1401 if (video_weblayer_)
1402 video_weblayer_->layer()->SetContentsOpaque(opaque_); 1402 video_weblayer_->layer()->SetContentsOpaque(opaque_);
1403 } 1403 }
1404 1404
1405 void WebMediaPlayerImpl::OnFrameHidden() { 1405 void WebMediaPlayerImpl::OnFrameHidden() {
1406 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1406 DCHECK(main_task_runner_->BelongsToCurrentThread());
1407 1407
1408 if (watch_time_reporter_) 1408 if (watch_time_reporter_)
1409 watch_time_reporter_->OnHidden(); 1409 watch_time_reporter_->OnHidden();
1410 1410
1411 if (ShouldPauseVideoWhenHidden()) { 1411 // OnFrameHidden() can be called when frame is closed, then IsHidden() will
1412 PauseVideoIfNeeded(); 1412 // return false, so check explicitly.
1413 return; 1413 if (IsHidden()) {
1414 } else { 1414 if (ShouldPauseVideoWhenHidden()) {
1415 DisableVideoTrackIfNeeded(); 1415 PauseVideoIfNeeded();
1416 return;
1417 } else {
1418 DisableVideoTrackIfNeeded();
1419 }
1416 } 1420 }
1417 1421
1418 UpdatePlayState(); 1422 UpdatePlayState();
1419 1423
1420 // Schedule suspended playing media to be paused if the user doesn't come back 1424 // Schedule suspended playing media to be paused if the user doesn't come back
1421 // to it within some timeout period to avoid any autoplay surprises. 1425 // to it within some timeout period to avoid any autoplay surprises.
1422 ScheduleIdlePauseTimer(); 1426 ScheduleIdlePauseTimer();
1423 } 1427 }
1424 1428
1425 void WebMediaPlayerImpl::OnFrameClosed() { 1429 void WebMediaPlayerImpl::OnFrameClosed() {
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2259 UMA_HISTOGRAM_TIMES( 2263 UMA_HISTOGRAM_TIMES(
2260 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack", 2264 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack",
2261 time_to_first_frame); 2265 time_to_first_frame);
2262 } else { 2266 } else {
2263 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused", 2267 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused",
2264 time_to_first_frame); 2268 time_to_first_frame);
2265 } 2269 }
2266 } 2270 }
2267 2271
2268 } // namespace media 2272 } // 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