diff options
author | Gloria Wang <gwang@google.com> | 2011-07-27 14:10:53 -0700 |
---|---|---|
committer | Gloria Wang <gwang@google.com> | 2011-07-27 14:10:53 -0700 |
commit | f9d566ef54954c5e7b913275438e8022fb194ad6 (patch) | |
tree | ebec64ece215e2e4133b9b128175cc612880da1e /media/libstagefright/MP3Extractor.cpp | |
parent | 288b66b60c9b3af3d84408885d0a4030c45eea9a (diff) | |
download | frameworks_av-f9d566ef54954c5e7b913275438e8022fb194ad6.zip frameworks_av-f9d566ef54954c5e7b913275438e8022fb194ad6.tar.gz frameworks_av-f9d566ef54954c5e7b913275438e8022fb194ad6.tar.bz2 |
Re-calculate mCurrentTimeUs for MP3 CBR seek because we might have
called Resync() which changes mCurrentPos.
For bug 4869063.
Change-Id: I5c5876ad81adf0ced1a6e6c18cda6905bf38f731
Diffstat (limited to 'media/libstagefright/MP3Extractor.cpp')
-rw-r--r-- | media/libstagefright/MP3Extractor.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/media/libstagefright/MP3Extractor.cpp b/media/libstagefright/MP3Extractor.cpp index 5bbed5d..92e84c2 100644 --- a/media/libstagefright/MP3Extractor.cpp +++ b/media/libstagefright/MP3Extractor.cpp @@ -407,6 +407,8 @@ status_t MP3Source::read( int64_t seekTimeUs; ReadOptions::SeekMode mode; + bool seekCBR = false; + if (options != NULL && options->getSeekTo(&seekTimeUs, &mode)) { int64_t actualSeekTimeUs = seekTimeUs; if (mSeeker == NULL @@ -421,6 +423,7 @@ status_t MP3Source::read( mCurrentTimeUs = seekTimeUs; mCurrentPos = mFirstFramePos + seekTimeUs * bitrate / 8000000; + seekCBR = true; } else { mCurrentTimeUs = actualSeekTimeUs; } @@ -454,6 +457,13 @@ status_t MP3Source::read( && GetMPEGAudioFrameSize( header, &frame_size, &sample_rate, NULL, &bitrate, &num_samples)) { + + // re-calculate mCurrentTimeUs because we might have called Resync() + if (seekCBR) { + mCurrentTimeUs = (mCurrentPos - mFirstFramePos) * 8000 / bitrate; + mBasisTimeUs = mCurrentTimeUs; + } + break; } |