| OLD | NEW |
| 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 "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1504 | 1504 |
| 1505 void WebMediaPlayerAndroid::OnWaitingForDecryptionKey() { | 1505 void WebMediaPlayerAndroid::OnWaitingForDecryptionKey() { |
| 1506 encrypted_client_->didBlockPlaybackWaitingForKey(); | 1506 encrypted_client_->didBlockPlaybackWaitingForKey(); |
| 1507 | 1507 |
| 1508 // TODO(jrummell): didResumePlaybackBlockedForKey() should only be called | 1508 // TODO(jrummell): didResumePlaybackBlockedForKey() should only be called |
| 1509 // when a key has been successfully added (e.g. OnSessionKeysChange() with | 1509 // when a key has been successfully added (e.g. OnSessionKeysChange() with |
| 1510 // |has_additional_usable_key| = true). http://crbug.com/461903 | 1510 // |has_additional_usable_key| = true). http://crbug.com/461903 |
| 1511 encrypted_client_->didResumePlaybackBlockedForKey(); | 1511 encrypted_client_->didResumePlaybackBlockedForKey(); |
| 1512 } | 1512 } |
| 1513 | 1513 |
| 1514 void WebMediaPlayerAndroid::OnHidden(bool must_suspend) { | 1514 void WebMediaPlayerAndroid::OnHidden() { |
| 1515 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1515 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1516 switches::kDisableMediaSuspend)) { | 1516 switches::kDisableMediaSuspend)) { |
| 1517 return; | 1517 return; |
| 1518 } | 1518 } |
| 1519 | 1519 |
| 1520 OnSuspendRequested(false); |
| 1521 } |
| 1522 |
| 1523 void WebMediaPlayerAndroid::OnShown() {} |
| 1524 |
| 1525 void WebMediaPlayerAndroid::OnSuspendRequested(bool must_suspend) { |
| 1520 // If we're idle or playing video, pause and release resources; audio only | 1526 // If we're idle or playing video, pause and release resources; audio only |
| 1521 // players are allowed to continue playing in the background unless indicated | 1527 // players are allowed to continue unless indicated otherwise by the call. |
| 1522 // otherwise by the call. | |
| 1523 if (must_suspend || (paused() && playback_completed_) || hasVideo()) | 1528 if (must_suspend || (paused() && playback_completed_) || hasVideo()) |
| 1524 SuspendAndReleaseResources(); | 1529 SuspendAndReleaseResources(); |
| 1525 } | 1530 } |
| 1526 | 1531 |
| 1527 void WebMediaPlayerAndroid::OnShown() {} | |
| 1528 | |
| 1529 void WebMediaPlayerAndroid::OnPlay() { | 1532 void WebMediaPlayerAndroid::OnPlay() { |
| 1530 play(); | 1533 play(); |
| 1531 client_->playbackStateChanged(); | 1534 client_->playbackStateChanged(); |
| 1532 } | 1535 } |
| 1533 | 1536 |
| 1534 void WebMediaPlayerAndroid::OnPause() { | 1537 void WebMediaPlayerAndroid::OnPause() { |
| 1535 pause(); | 1538 pause(); |
| 1536 client_->playbackStateChanged(); | 1539 client_->playbackStateChanged(); |
| 1537 } | 1540 } |
| 1538 | 1541 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; | 1664 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; |
| 1662 } else if (is_hls_url == is_hls) { | 1665 } else if (is_hls_url == is_hls) { |
| 1663 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; | 1666 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; |
| 1664 } | 1667 } |
| 1665 UMA_HISTOGRAM_ENUMERATION( | 1668 UMA_HISTOGRAM_ENUMERATION( |
| 1666 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", | 1669 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", |
| 1667 result, PREDICTION_RESULT_MAX); | 1670 result, PREDICTION_RESULT_MAX); |
| 1668 } | 1671 } |
| 1669 | 1672 |
| 1670 } // namespace content | 1673 } // namespace content |
| OLD | NEW |