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" |
11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/float_util.h" | 14 #include "base/float_util.h" |
wolenetz
2014/10/27 20:14:25
nit: do we no longer need this since we're droppin
DaleCurtis
2014/10/27 20:20:41
Done.
| |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
20 #include "cc/blink/web_layer_impl.h" | 20 #include "cc/blink/web_layer_impl.h" |
21 #include "cc/layers/video_layer.h" | 21 #include "cc/layers/video_layer.h" |
22 #include "content/public/common/content_client.h" | 22 #include "content/public/common/content_client.h" |
23 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
24 #include "content/public/renderer/render_frame.h" | 24 #include "content/public/renderer/render_frame.h" |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 return ready_state_; | 518 return ready_state_; |
519 } | 519 } |
520 | 520 |
521 blink::WebTimeRanges WebMediaPlayerAndroid::buffered() const { | 521 blink::WebTimeRanges WebMediaPlayerAndroid::buffered() const { |
522 if (media_source_delegate_) | 522 if (media_source_delegate_) |
523 return media_source_delegate_->Buffered(); | 523 return media_source_delegate_->Buffered(); |
524 return buffered_; | 524 return buffered_; |
525 } | 525 } |
526 | 526 |
527 blink::WebTimeRanges WebMediaPlayerAndroid::seekable() const { | 527 blink::WebTimeRanges WebMediaPlayerAndroid::seekable() const { |
528 // Media without duration are considered streaming and should not be seekable. | 528 if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata) |
529 const double seekable_end = duration(); | |
530 if (!base::IsFinite(seekable_end)) | |
531 return blink::WebTimeRanges(); | 529 return blink::WebTimeRanges(); |
532 | 530 |
533 // If we have a finite duration then use [0, duration] as the seekable range. | 531 // TODO(dalecurtis): Technically this allows seeking on media which return an |
534 blink::WebTimeRange seekable_range(0.0, seekable_end); | 532 // infinite duration. While not expected, disabling this breaks semi-live |
533 // players, http://crbug.com/427412. | |
534 const blink::WebTimeRange seekable_range(0.0, duration()); | |
wolenetz
2014/10/27 20:14:25
Versus pre-621573002, we now allow for duration()
DaleCurtis
2014/10/27 20:20:41
Nice eye, it was intended in my original CL and I
wolenetz
2014/10/27 20:26:47
Acknowledged.
| |
535 return blink::WebTimeRanges(&seekable_range, 1); | 535 return blink::WebTimeRanges(&seekable_range, 1); |
536 } | 536 } |
537 | 537 |
538 bool WebMediaPlayerAndroid::didLoadingProgress() { | 538 bool WebMediaPlayerAndroid::didLoadingProgress() { |
539 bool ret = did_loading_progress_; | 539 bool ret = did_loading_progress_; |
540 did_loading_progress_ = false; | 540 did_loading_progress_ = false; |
541 return ret; | 541 return ret; |
542 } | 542 } |
543 | 543 |
544 bool WebMediaPlayerAndroid::EnsureTextureBackedSkBitmap(GrContext* gr, | 544 bool WebMediaPlayerAndroid::EnsureTextureBackedSkBitmap(GrContext* gr, |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1826 | 1826 |
1827 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1827 bool WebMediaPlayerAndroid::IsHLSStream() const { |
1828 std::string mime; | 1828 std::string mime; |
1829 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1829 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
1830 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1830 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
1831 return false; | 1831 return false; |
1832 return !mime.compare("application/x-mpegurl"); | 1832 return !mime.compare("application/x-mpegurl"); |
1833 } | 1833 } |
1834 | 1834 |
1835 } // namespace content | 1835 } // namespace content |
OLD | NEW |