Skip to content

Commit 92f5f58

Browse files
committed
Do not report a duration for a live stream.
Also, do not clamp the playback position to the duration if the duration is unknown. Bug: 6672119 Change-Id: Id18bf3d45d4fe7d5edc2ac2da492ca5b4f217826
1 parent 1d28fef commit 92f5f58

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

media/libaah_rtp/aah_rx_player.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,9 @@ status_t AAH_RXPlayer::getCurrentPosition(int *msec) {
202202
}
203203

204204
status_t AAH_RXPlayer::getDuration(int *msec) {
205-
if (NULL != msec) {
206-
*msec = 1;
207-
}
208-
return OK;
205+
// Other media players are returning UNKNOWN_ERROR for streams of unknown
206+
// length
207+
return UNKNOWN_ERROR;
209208
}
210209

211210
status_t AAH_RXPlayer::reset() {

media/libaah_rtp/aah_tx_player.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ void AAH_TXPlayer::onPrepareAsyncEvent() {
410410

411411
mAudioFormat = mAudioSource->getFormat();
412412
if (!mAudioFormat->findInt64(kKeyDuration, &mDurationUs))
413-
mDurationUs = 1;
413+
mDurationUs = -1;
414414

415415
const char* mime_type = NULL;
416416
if (!mAudioFormat->findCString(kKeyMIMEType, &mime_type)) {
@@ -1061,7 +1061,7 @@ void AAH_TXPlayer::onBufferingUpdate() {
10611061
}
10621062
} else {
10631063
int64_t bitrate;
1064-
if (getBitrate_l(&bitrate)) {
1064+
if (getBitrate_l(&bitrate) && mDurationUs > 0) {
10651065
size_t cachedSize = mCachedSource->cachedSize();
10661066
int64_t cachedDurationUs = cachedSize * 8000000ll / bitrate;
10671067

0 commit comments

Comments
 (0)