From 6e8f0bc59ad2409b294ad4eb803131500306bc8b Mon Sep 17 00:00:00 2001 From: Dylan Powers Date: Tue, 27 Nov 2012 16:06:38 -0800 Subject: Bug fix for the MediaPlayer::prepare() api. For an MP3 source, within the prepare command, ID3 tags are checked in search of gapless playback info. This causes problems for streamed sources. If ID3v2 tags aren't present, then a check is done for ID3v1 tags. This results in a read command that asks the cache to jump to the end of the file, and subsequently make an extra http call to request those bytes. For a streamed source, this causes the file to not be downloaded automatically when MediaPlayer::prepare() is called, and causes stuttering and extra buffering time to be needed when start() is finally called. The solution is to ignore the ID3v1 tags as the gapless info would never exist there, and only check for ID3v2 tags. Change-Id: I7d1b94cffbfe7c38ca094834dedbc92a58855e20 --- media/libstagefright/MP3Extractor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'media/libstagefright/MP3Extractor.cpp') diff --git a/media/libstagefright/MP3Extractor.cpp b/media/libstagefright/MP3Extractor.cpp index d94054b..380dab4 100644 --- a/media/libstagefright/MP3Extractor.cpp +++ b/media/libstagefright/MP3Extractor.cpp @@ -350,8 +350,10 @@ MP3Extractor::MP3Extractor( mInitCheck = OK; - // get iTunes-style gapless info if present - ID3 id3(mDataSource); + // Get iTunes-style gapless info if present. + // When getting the id3 tag, skip the V1 tags to prevent the source cache + // from being iterated to the end of the file. + ID3 id3(mDataSource, true); if (id3.isValid()) { ID3::Iterator *com = new ID3::Iterator(id3, "COM"); if (com->done()) { -- cgit v1.1