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

Unified Diff: webkit/media/android/webmediaplayer_android.cc

Issue 11412251: Fix a bug that hasVideo() always returns true even after we have the size info (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: webkit/media/android/webmediaplayer_android.cc
diff --git a/webkit/media/android/webmediaplayer_android.cc b/webkit/media/android/webmediaplayer_android.cc
index 6c0722cee6fd16ab5f4f856aa55c805e21593d73..ef8248ee9af952df578271e955df160667a4420b 100644
--- a/webkit/media/android/webmediaplayer_android.cc
+++ b/webkit/media/android/webmediaplayer_android.cc
@@ -41,6 +41,7 @@ WebMediaPlayerAndroid::WebMediaPlayerAndroid(
ready_state_(WebMediaPlayer::ReadyStateHaveNothing),
is_playing_(false),
needs_establish_peer_(true),
+ has_size_info_(false),
stream_texture_factory_(factory) {
main_loop_->AddDestructionObserver(this);
if (manager_)
@@ -130,8 +131,8 @@ bool WebMediaPlayerAndroid::totalBytesKnown() {
bool WebMediaPlayerAndroid::hasVideo() const {
// If we have obtained video size information before, use it.
- if (!natural_size_.isEmpty())
- return true;
+ if (has_size_info_)
+ return !natural_size_.isEmpty();
// TODO(qinmin): need a better method to determine whether the current media
// content contains video. Android does not provide any function to do
@@ -323,6 +324,7 @@ void WebMediaPlayerAndroid::OnMediaError(int error_type) {
}
void WebMediaPlayerAndroid::OnVideoSizeChanged(int width, int height) {
+ has_size_info_ = true;
Miguel Garcia 2012/11/29 20:28:02 shouldn't you check that width or height is > 0?
qinmin 2012/11/29 20:39:33 No, we don't. This is called by the android media
Miguel Garcia 2012/11/29 20:43:36 OK, makes sense On 2012/11/29 20:39:33, qinmin w
if (natural_size_.width == width && natural_size_.height == height)
return;

Powered by Google App Engine
This is Rietveld 408576698