File tree Expand file tree Collapse file tree 1 file changed +15
-16
lines changed
Expand file tree Collapse file tree 1 file changed +15
-16
lines changed Original file line number Diff line number Diff line change @@ -52,10 +52,7 @@ static bool Resync(
5252 *post_id3_pos = 0 ;
5353 }
5454
55- bool resync_from_head = false ;
5655 if (*inout_pos == 0 ) {
57- resync_from_head = true ;
58-
5956 // Skip an optional ID3 header if syncing at the very beginning
6057 // of the datasource.
6158
@@ -140,20 +137,22 @@ static bool Resync(
140137
141138 uint32_t header = U32_AT (tmp);
142139
140+ if (match_header != 0 && (header & kMask ) != (match_header & kMask )) {
141+ ++pos;
142+ ++tmp;
143+ --remainingBytes;
144+ continue ;
145+ }
146+
143147 size_t frame_size;
144- if ((match_header != 0 && (header & kMask ) != (match_header & kMask ))
145- || !GetMPEGAudioFrameSize (header, &frame_size)) {
146- if (resync_from_head) {
147- // This isn't a valid mp3 file because it failed to detect
148- // a header while a valid mp3 file should have a valid
149- // header here.
150- break ;
151- } else {
152- ++pos;
153- ++tmp;
154- --remainingBytes;
155- continue ;
156- }
148+ int sample_rate, num_channels, bitrate;
149+ if (!GetMPEGAudioFrameSize (
150+ header, &frame_size,
151+ &sample_rate, &num_channels, &bitrate)) {
152+ ++pos;
153+ ++tmp;
154+ --remainingBytes;
155+ continue ;
157156 }
158157
159158 LOGV (" found possible 1st frame at %lld (header = 0x%08x)" , pos, header);
You can’t perform that action at this time.
0 commit comments