diff options
author | Ben Murdoch <benm@google.com> | 2010-12-09 11:54:29 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-12-09 11:54:29 -0800 |
commit | 83ddee4501f0c2f48d1073e0185a2fb0a732c929 (patch) | |
tree | 738471fe25c1e6751ee5b3eed68ad95bbc0c1fc0 | |
parent | 5bc26f035677551d16806dc67e2576564cb9f494 (diff) | |
parent | cc8efdb105eca2870832ff81e3b618f4715cc7d6 (diff) | |
download | external_webkit-83ddee4501f0c2f48d1073e0185a2fb0a732c929.zip external_webkit-83ddee4501f0c2f48d1073e0185a2fb0a732c929.tar.gz external_webkit-83ddee4501f0c2f48d1073e0185a2fb0a732c929.tar.bz2 |
Merge "Update Audio MediaPlayer to cope with a live stream"
-rw-r--r-- | WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp index c05a417..bdae711 100644 --- a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp +++ b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp @@ -413,7 +413,16 @@ public: } void onPrepared(int duration, int width, int height) { - m_duration = duration / 1000.0f; + // Android media player gives us a duration of 0 for a live + // stream, so in that case set the real duration to infinity. + // We'll still be able to handle the case that we genuinely + // get an audio clip with a duration of 0s as we'll get the + // ended event when it stops playing. + if (duration > 0) { + m_duration = duration / 1000.0f; + } else { + m_duration = std::numeric_limits<float>::infinity(); + } m_player->durationChanged(); m_player->sizeChanged(); m_player->prepareToPlay(); |