diff options
author | Ben Murdoch <benm@google.com> | 2010-12-09 15:46:20 +0000 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-12-09 15:46:20 +0000 |
commit | cc8efdb105eca2870832ff81e3b618f4715cc7d6 (patch) | |
tree | 58f7cf7642045b43785e92ddcb02689e8321e566 | |
parent | 8a8bcba6421d62a32ffbc3a2461cb978d522dbdc (diff) | |
download | external_webkit-cc8efdb105eca2870832ff81e3b618f4715cc7d6.zip external_webkit-cc8efdb105eca2870832ff81e3b618f4715cc7d6.tar.gz external_webkit-cc8efdb105eca2870832ff81e3b618f4715cc7d6.tar.bz2 |
Update Audio MediaPlayer to cope with a live stream
The Android framework gives us a duration of 0s for a live stream
so in that case tell WebCore we have an infinite duration.
Change-Id: I5caea8401406785eba61424cdb02abf9bfab0912
-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(); |