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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 503 WebMediaPlayer::ReadyState WebMediaPlayerAndroid::readyState() const { | 503 WebMediaPlayer::ReadyState WebMediaPlayerAndroid::readyState() const { |
| 504 return ready_state_; | 504 return ready_state_; |
| 505 } | 505 } |
| 506 | 506 |
| 507 WebTimeRanges WebMediaPlayerAndroid::buffered() const { | 507 WebTimeRanges WebMediaPlayerAndroid::buffered() const { |
| 508 if (media_source_delegate_) | 508 if (media_source_delegate_) |
| 509 return media_source_delegate_->Buffered(); | 509 return media_source_delegate_->Buffered(); |
| 510 return buffered_; | 510 return buffered_; |
| 511 } | 511 } |
| 512 | 512 |
| 513 double WebMediaPlayerAndroid::maxTimeSeekable() const { | 513 WebTimeRanges WebMediaPlayerAndroid::seekable() const { |
| 514 // If we haven't even gotten to ReadyStateHaveMetadata yet then just | 514 // If we haven't even gotten to ReadyStateHaveMetadata yet then there |
| 515 // return 0 so that the seekable range is empty. | 515 // are no seekable ranges. |
| 516 if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata) | 516 if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata) |
| 517 return 0.0; | 517 return WebTimeRanges(); |
| 518 | 518 |
|
DaleCurtis
2014/09/26 20:45:24
WDYT about reordering slightly so that:
const dou
philipj_slow
2014/09/29 09:33:44
Done.
| |
| 519 return duration(); | 519 // If we have a duration then use [0, duration] as the seekable range. |
|
scherkus (not reviewing)
2014/09/26 18:53:27
silly math/interval notation question: seeking to
philipj_slow
2014/09/26 20:32:02
Right, these are inclusive intervals, not only for
| |
| 520 if (double range_end = duration()) { | |
| 521 WebTimeRanges ranges(static_cast<size_t>(1)); | |
| 522 ranges[0].start = 0.0; | |
| 523 ranges[0].end = range_end; | |
| 524 return ranges; | |
| 525 } | |
| 526 | |
| 527 return WebTimeRanges(); | |
| 520 } | 528 } |
| 521 | 529 |
| 522 bool WebMediaPlayerAndroid::didLoadingProgress() { | 530 bool WebMediaPlayerAndroid::didLoadingProgress() { |
| 523 bool ret = did_loading_progress_; | 531 bool ret = did_loading_progress_; |
| 524 did_loading_progress_ = false; | 532 did_loading_progress_ = false; |
| 525 return ret; | 533 return ret; |
| 526 } | 534 } |
| 527 | 535 |
| 528 bool WebMediaPlayerAndroid::EnsureTextureBackedSkBitmap(GrContext* gr, | 536 bool WebMediaPlayerAndroid::EnsureTextureBackedSkBitmap(GrContext* gr, |
| 529 SkBitmap& bitmap, | 537 SkBitmap& bitmap, |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1814 | 1822 |
| 1815 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1823 bool WebMediaPlayerAndroid::IsHLSStream() const { |
| 1816 std::string mime; | 1824 std::string mime; |
| 1817 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1825 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
| 1818 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1826 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
| 1819 return false; | 1827 return false; |
| 1820 return !mime.compare("application/x-mpegurl"); | 1828 return !mime.compare("application/x-mpegurl"); |
| 1821 } | 1829 } |
| 1822 | 1830 |
| 1823 } // namespace content | 1831 } // namespace content |
| OLD | NEW |