Chromium Code Reviews| 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 513 WebMediaPlayer::ReadyState WebMediaPlayerAndroid::readyState() const { | 513 WebMediaPlayer::ReadyState WebMediaPlayerAndroid::readyState() const { |
| 514 return ready_state_; | 514 return ready_state_; |
| 515 } | 515 } |
| 516 | 516 |
| 517 WebTimeRanges WebMediaPlayerAndroid::buffered() const { | 517 WebTimeRanges WebMediaPlayerAndroid::buffered() const { |
| 518 if (media_source_delegate_) | 518 if (media_source_delegate_) |
| 519 return media_source_delegate_->Buffered(); | 519 return media_source_delegate_->Buffered(); |
| 520 return buffered_; | 520 return buffered_; |
| 521 } | 521 } |
| 522 | 522 |
| 523 double WebMediaPlayerAndroid::maxTimeSeekable() const { | 523 WebTimeRanges WebMediaPlayerAndroid::seekable() const { |
| 524 // If we haven't even gotten to ReadyStateHaveMetadata yet then just | 524 // If we haven't even gotten to ReadyStateHaveMetadata yet then there |
| 525 // return 0 so that the seekable range is empty. | 525 // are no seekable ranges. |
| 526 if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata) | 526 if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata) |
| 527 return 0.0; | 527 return WebTimeRanges(); |
| 528 | 528 |
| 529 return duration(); | 529 // If we have a duration then use [0, duration] as the seekable range. |
| 530 const double duration = this->duration(); | |
|
DaleCurtis
2014/09/29 16:52:43
Avoid this-> with current_duration or something? I
philipj_slow
2014/09/29 19:51:46
I don't like this style either, I was just going w
philipj_slow
2014/09/30 08:09:28
seekable_end it is.
| |
| 531 if (!duration) | |
| 532 return WebTimeRanges(); | |
| 533 | |
| 534 WebTimeRanges ranges(static_cast<size_t>(1)); | |
|
DaleCurtis
2014/09/29 16:52:43
Does 1 hit a compiler error somewhere? 1u should w
philipj_slow
2014/09/29 19:51:46
Yes, it's ambiguous because WebVector has so many
philipj_slow
2014/09/30 08:09:28
I went with the WebVector(const U* values, size_t
| |
| 535 ranges[0].start = 0.0; | |
| 536 ranges[0].end = duration; | |
| 537 return ranges; | |
| 530 } | 538 } |
| 531 | 539 |
| 532 bool WebMediaPlayerAndroid::didLoadingProgress() { | 540 bool WebMediaPlayerAndroid::didLoadingProgress() { |
| 533 bool ret = did_loading_progress_; | 541 bool ret = did_loading_progress_; |
| 534 did_loading_progress_ = false; | 542 did_loading_progress_ = false; |
| 535 return ret; | 543 return ret; |
| 536 } | 544 } |
| 537 | 545 |
| 538 bool WebMediaPlayerAndroid::EnsureTextureBackedSkBitmap(GrContext* gr, | 546 bool WebMediaPlayerAndroid::EnsureTextureBackedSkBitmap(GrContext* gr, |
| 539 SkBitmap& bitmap, | 547 SkBitmap& bitmap, |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1824 | 1832 |
| 1825 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1833 bool WebMediaPlayerAndroid::IsHLSStream() const { |
| 1826 std::string mime; | 1834 std::string mime; |
| 1827 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1835 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
| 1828 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1836 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
| 1829 return false; | 1837 return false; |
| 1830 return !mime.compare("application/x-mpegurl"); | 1838 return !mime.compare("application/x-mpegurl"); |
| 1831 } | 1839 } |
| 1832 | 1840 |
| 1833 } // namespace content | 1841 } // namespace content |
| OLD | NEW |