Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 572803002: Fix an issue that video is not seekable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 // already triggers a durationchanged event. If this is a different 728 // already triggers a durationchanged event. If this is a different
729 // transition, remember to signal durationchanged. 729 // transition, remember to signal durationchanged.
730 // Do not ever signal durationchanged on metadata change in MSE case 730 // Do not ever signal durationchanged on metadata change in MSE case
731 // because OnDurationChanged() handles this. 731 // because OnDurationChanged() handles this.
732 if (ready_state_ > WebMediaPlayer::ReadyStateHaveNothing && 732 if (ready_state_ > WebMediaPlayer::ReadyStateHaveNothing &&
733 player_type_ != MEDIA_PLAYER_TYPE_MEDIA_SOURCE) { 733 player_type_ != MEDIA_PLAYER_TYPE_MEDIA_SOURCE) {
734 need_to_signal_duration_changed = true; 734 need_to_signal_duration_changed = true;
735 } 735 }
736 } 736 }
737 737
738 has_valid_metadata_ = success;
xhwang 2014/09/15 23:59:43 Add a comment that setting it here instead of late
qinmin 2014/09/16 00:30:52 Done.
738 if (ready_state_ != WebMediaPlayer::ReadyStateHaveEnoughData) { 739 if (ready_state_ != WebMediaPlayer::ReadyStateHaveEnoughData) {
739 UpdateReadyState(WebMediaPlayer::ReadyStateHaveMetadata); 740 UpdateReadyState(WebMediaPlayer::ReadyStateHaveMetadata);
740 UpdateReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); 741 UpdateReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
741 } 742 }
742 743
743 // TODO(wolenetz): Should we just abort early and set network state to an 744 // TODO(wolenetz): Should we just abort early and set network state to an
744 // error if success == false? See http://crbug.com/248399 745 // error if success == false? See http://crbug.com/248399
745 if (success) 746 if (success)
746 OnVideoSizeChanged(width, height); 747 OnVideoSizeChanged(width, height);
747 748
748 has_valid_metadata_ = success;
749
750 if (need_to_signal_duration_changed) 749 if (need_to_signal_duration_changed)
751 client_->durationChanged(); 750 client_->durationChanged();
752 } 751 }
753 752
754 void WebMediaPlayerAndroid::OnPlaybackComplete() { 753 void WebMediaPlayerAndroid::OnPlaybackComplete() {
755 // When playback is about to finish, android media player often stops 754 // When playback is about to finish, android media player often stops
756 // at a time which is smaller than the duration. This makes webkit never 755 // at a time which is smaller than the duration. This makes webkit never
757 // know that the playback has finished. To solve this, we set the 756 // know that the playback has finished. To solve this, we set the
758 // current time to media duration when OnPlaybackComplete() get called. 757 // current time to media duration when OnPlaybackComplete() get called.
759 interpolator_.SetBounds(duration_, duration_); 758 interpolator_.SetBounds(duration_, duration_);
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 1790
1792 bool WebMediaPlayerAndroid::IsHLSStream() const { 1791 bool WebMediaPlayerAndroid::IsHLSStream() const {
1793 std::string mime; 1792 std::string mime;
1794 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; 1793 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_;
1795 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) 1794 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime))
1796 return false; 1795 return false;
1797 return !mime.compare("application/x-mpegurl"); 1796 return !mime.compare("application/x-mpegurl");
1798 } 1797 }
1799 1798
1800 } // namespace content 1799 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698