From 9e50385f34676d8fcb3b473ec4c9f5c388a4c887 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Fri, 16 Mar 2012 07:56:42 -0700 Subject: Skip XING/VBRI frame when decoding Don't send the XING/VBRI frame to the decoder, as it will result in extra data being output. Also clean up the XING seeker code a bit. Change-Id: I714a94180edae9bedc1bc0c96bf382fe6f928ac6 --- media/libstagefright/MP3Extractor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'media/libstagefright/MP3Extractor.cpp') diff --git a/media/libstagefright/MP3Extractor.cpp b/media/libstagefright/MP3Extractor.cpp index 2215c07..69209b5 100644 --- a/media/libstagefright/MP3Extractor.cpp +++ b/media/libstagefright/MP3Extractor.cpp @@ -317,6 +317,13 @@ MP3Extractor::MP3Extractor( mSeeker = VBRISeeker::CreateFromSource(mDataSource, post_id3_pos); } + if (mSeeker != NULL) { + // While it is safe to send the XING/VBRI frame to the decoder, this will + // result in an extra 1152 samples being output. The real first frame to + // decode is after the XING/VBRI frame, so skip there. + mFirstFramePos += frame_size; + } + int64_t durationUs; if (mSeeker == NULL || !mSeeker->getDuration(&durationUs)) { -- cgit v1.1