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 <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #include "third_party/skia/include/core/SkPaint.h" | 57 #include "third_party/skia/include/core/SkPaint.h" |
58 #include "third_party/skia/include/core/SkTypeface.h" | 58 #include "third_party/skia/include/core/SkTypeface.h" |
59 #include "ui/gfx/image/image.h" | 59 #include "ui/gfx/image/image.h" |
60 | 60 |
61 static const uint32 kGLTextureExternalOES = 0x8D65; | 61 static const uint32 kGLTextureExternalOES = 0x8D65; |
62 static const int kSDKVersionToSupportSecurityOriginCheck = 20; | 62 static const int kSDKVersionToSupportSecurityOriginCheck = 20; |
63 | 63 |
64 using blink::WebMediaPlayer; | 64 using blink::WebMediaPlayer; |
65 using blink::WebSize; | 65 using blink::WebSize; |
66 using blink::WebString; | 66 using blink::WebString; |
67 using blink::WebTimeRanges; | |
68 using blink::WebURL; | 67 using blink::WebURL; |
69 using gpu::gles2::GLES2Interface; | 68 using gpu::gles2::GLES2Interface; |
70 using media::MediaPlayerAndroid; | 69 using media::MediaPlayerAndroid; |
71 using media::VideoFrame; | 70 using media::VideoFrame; |
72 | 71 |
73 namespace { | 72 namespace { |
74 // Prefix for histograms related to Encrypted Media Extensions. | 73 // Prefix for histograms related to Encrypted Media Extensions. |
75 const char* kMediaEme = "Media.EME."; | 74 const char* kMediaEme = "Media.EME."; |
76 | 75 |
77 // File-static function is to allow it to run even after WMPA is deleted. | 76 // File-static function is to allow it to run even after WMPA is deleted. |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 } | 506 } |
508 | 507 |
509 WebMediaPlayer::NetworkState WebMediaPlayerAndroid::networkState() const { | 508 WebMediaPlayer::NetworkState WebMediaPlayerAndroid::networkState() const { |
510 return network_state_; | 509 return network_state_; |
511 } | 510 } |
512 | 511 |
513 WebMediaPlayer::ReadyState WebMediaPlayerAndroid::readyState() const { | 512 WebMediaPlayer::ReadyState WebMediaPlayerAndroid::readyState() const { |
514 return ready_state_; | 513 return ready_state_; |
515 } | 514 } |
516 | 515 |
517 WebTimeRanges WebMediaPlayerAndroid::buffered() const { | 516 blink::WebTimeRanges WebMediaPlayerAndroid::buffered() const { |
518 if (media_source_delegate_) | 517 if (media_source_delegate_) |
519 return media_source_delegate_->Buffered(); | 518 return media_source_delegate_->Buffered(); |
520 return buffered_; | 519 return buffered_; |
521 } | 520 } |
522 | 521 |
523 double WebMediaPlayerAndroid::maxTimeSeekable() const { | 522 blink::WebTimeRanges WebMediaPlayerAndroid::seekable() const { |
524 // If we haven't even gotten to ReadyStateHaveMetadata yet then just | 523 // If we haven't even gotten to ReadyStateHaveMetadata yet then there |
525 // return 0 so that the seekable range is empty. | 524 // are no seekable ranges. |
526 if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata) | 525 if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata) |
527 return 0.0; | 526 return blink::WebTimeRanges(); |
528 | 527 |
529 return duration(); | 528 // If we have a duration then use [0, duration] as the seekable range. |
| 529 const double seekable_end = duration(); |
| 530 if (!seekable_end) |
| 531 return blink::WebTimeRanges(); |
| 532 |
| 533 blink::WebTimeRange seekable_range(0.0, seekable_end); |
| 534 return blink::WebTimeRanges(&seekable_range, 1); |
530 } | 535 } |
531 | 536 |
532 bool WebMediaPlayerAndroid::didLoadingProgress() { | 537 bool WebMediaPlayerAndroid::didLoadingProgress() { |
533 bool ret = did_loading_progress_; | 538 bool ret = did_loading_progress_; |
534 did_loading_progress_ = false; | 539 did_loading_progress_ = false; |
535 return ret; | 540 return ret; |
536 } | 541 } |
537 | 542 |
538 bool WebMediaPlayerAndroid::EnsureTextureBackedSkBitmap(GrContext* gr, | 543 bool WebMediaPlayerAndroid::EnsureTextureBackedSkBitmap(GrContext* gr, |
539 SkBitmap& bitmap, | 544 SkBitmap& bitmap, |
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 | 1829 |
1825 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1830 bool WebMediaPlayerAndroid::IsHLSStream() const { |
1826 std::string mime; | 1831 std::string mime; |
1827 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1832 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
1828 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1833 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
1829 return false; | 1834 return false; |
1830 return !mime.compare("application/x-mpegurl"); | 1835 return !mime.compare("application/x-mpegurl"); |
1831 } | 1836 } |
1832 | 1837 |
1833 } // namespace content | 1838 } // namespace content |
OLD | NEW |