IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
how mp3 decoders handle broken frames and garbage data?
sun4384
post Dec 14 2008, 02:23
Post #1





Group: Members
Posts: 85
Joined: 22-July 08
Member No.: 56147



When there is a broken (incomplete) mp3 frame in an mp3 file, how do decoders handle them? Are they just ignored, partially played, some recovery is made, or something else? If such broken frame occurs in the middle of a file rather than at the end, how does it affect decoding the next adjacent frame? Suppose we have two mp3 frames f1 and f2 next to each other in that order, and f1 is incomplete. When decoding f1, is it
- possible to recognize f1 is broken (do something for that) and successfully decode f2,
- or the beginning of f2 is somehow mis-considered as part of f1, so f2 fails to decode?

How about garbage data after a valid frame? Are they completely ignored until another valid frame is detected?

This post has been edited by sun4384: Dec 14 2008, 02:25
Go to the top of the page
+Quote Post
saratoga
post Dec 14 2008, 04:25
Post #2





Group: Members
Posts: 4718
Joined: 2-September 02
Member No.: 3264



I don't know about MP3 specifically, but in general:

The front of each frame in most formats has a header that you can sanity check. If it fails you try to skip to the next frame.

If the next frame passes the sanity check you decode it and everything is fine except for a couple dozen milliseconds of missing data. If it doesn't, then you can keep going looking for a valid frame, or give up and ask your file parser for the next packet and hope its ok.

In rockbox for example, the WMA decoder retries decoding frames 5 times in a row. After that it gives up and asks the ASF parser for the next packet. If that packet doesn't pass a sanity check, it will request the next packet up to 5 times. After that it gives up and goes to the next file in the playlist. I added this logic after someone sent me a file that had some corruption. It fixed decoding of it with only a barely noticeable glitch.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th April 2014 - 05:06