summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2011-09-06 19:18:43 -0700
committerJames Dong <jdong@google.com>2011-09-06 19:18:43 -0700
commitd6e27296206b9f897401107f1c46f4ac2947be85 (patch)
tree1c86967dc53b99661fdf4272d89f8ed681364dc2 /media
parenta4f73a9e0e0863a567cc06defa0d9e0269388d4e (diff)
downloadframeworks_av-d6e27296206b9f897401107f1c46f4ac2947be85.zip
frameworks_av-d6e27296206b9f897401107f1c46f4ac2947be85.tar.gz
frameworks_av-d6e27296206b9f897401107f1c46f4ac2947be85.tar.bz2
Revert "To make SniffMP3() more concrete so that we can remove false-positve responses from MPEG-PS streams."
This reverts commit 983ab88e117fcbda9370b8f4ba94271d37149672. related-to-bug: 5231309
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/MP3Extractor.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/media/libstagefright/MP3Extractor.cpp b/media/libstagefright/MP3Extractor.cpp
index 09f91f5..92e84c2 100644
--- a/media/libstagefright/MP3Extractor.cpp
+++ b/media/libstagefright/MP3Extractor.cpp
@@ -52,10 +52,7 @@ static bool Resync(
*post_id3_pos = 0;
}
- bool resync_from_head = false;
if (*inout_pos == 0) {
- resync_from_head = true;
-
// Skip an optional ID3 header if syncing at the very beginning
// of the datasource.
@@ -140,20 +137,22 @@ static bool Resync(
uint32_t header = U32_AT(tmp);
+ if (match_header != 0 && (header & kMask) != (match_header & kMask)) {
+ ++pos;
+ ++tmp;
+ --remainingBytes;
+ continue;
+ }
+
size_t frame_size;
- if ((match_header != 0 && (header & kMask) != (match_header & kMask))
- || !GetMPEGAudioFrameSize(header, &frame_size)) {
- if (resync_from_head) {
- // This isn't a valid mp3 file because it failed to detect
- // a header while a valid mp3 file should have a valid
- // header here.
- break;
- } else {
- ++pos;
- ++tmp;
- --remainingBytes;
- continue;
- }
+ int sample_rate, num_channels, bitrate;
+ if (!GetMPEGAudioFrameSize(
+ header, &frame_size,
+ &sample_rate, &num_channels, &bitrate)) {
+ ++pos;
+ ++tmp;
+ --remainingBytes;
+ continue;
}
LOGV("found possible 1st frame at %lld (header = 0x%08x)", pos, header);