diff options
author | Andreas Huber <andih@google.com> | 2010-09-01 17:03:59 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-09-01 17:03:59 -0700 |
commit | 6faf0cd82346b23075d1f8b9f70f7af43f2c5f04 (patch) | |
tree | a7dac13317c6b8ad8606c367ff676590b15b82fd /media/libstagefright/AwesomePlayer.cpp | |
parent | 955c5d0e21097a4baccc3174fa43e9cfe45cfa9b (diff) | |
parent | 031ecf372128a786a9ae84aee9c681af7a0c7db1 (diff) | |
download | frameworks_av-6faf0cd82346b23075d1f8b9f70f7af43f2c5f04.zip frameworks_av-6faf0cd82346b23075d1f8b9f70f7af43f2c5f04.tar.gz frameworks_av-6faf0cd82346b23075d1f8b9f70f7af43f2c5f04.tar.bz2 |
am fd0eed00: am a2511da9: Merge "Better support for buffered streaming of rtsp content, if buffer drops below a certain threshold we will temporarily pause playback until we have sufficient data." into gingerbread
Merge commit 'fd0eed007d99178092ede56ec2c4799046615f70'
* commit 'fd0eed007d99178092ede56ec2c4799046615f70':
Better support for buffered streaming of rtsp content, if buffer drops below a certain threshold we will temporarily pause playback until we have sufficient data.
Diffstat (limited to 'media/libstagefright/AwesomePlayer.cpp')
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 183874c..e78a616 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -460,6 +460,33 @@ void AwesomePlayer::onBufferingUpdate() { } mBufferingEventPending = false; + int kLowWaterMarkSecs = 2; + int kHighWaterMarkSecs = 10; + + if (mRTSPController != NULL) { + bool eos; + int64_t queueDurationUs = mRTSPController->getQueueDurationUs(&eos); + + LOGV("queueDurationUs = %.2f secs", queueDurationUs / 1E6); + + if ((mFlags & PLAYING) && !eos + && (queueDurationUs < kLowWaterMarkSecs * 1000000ll)) { + LOGI("rtsp cache is running low, pausing."); + mFlags |= CACHE_UNDERRUN; + pause_l(); + notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_START); + } else if ((mFlags & CACHE_UNDERRUN) + && (eos || queueDurationUs > kHighWaterMarkSecs * 1000000ll)) { + LOGI("rtsp cache has filled up, resuming."); + mFlags &= ~CACHE_UNDERRUN; + play_l(); + notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_END); + } + + postBufferingEvent_l(); + return; + } + if (mCachedSource == NULL) { return; } @@ -487,8 +514,8 @@ void AwesomePlayer::onBufferingUpdate() { notifyListener_l(MEDIA_BUFFERING_UPDATE, percentage); - lowWatermark = 2 * bitrate / 8; // 2 secs - highWatermark = 10 * bitrate / 8; // 10 secs + lowWatermark = kLowWaterMarkSecs * bitrate / 8; + highWatermark = kHighWaterMarkSecs * bitrate / 8; } } |