Closed
Bug 1194085
Opened 9 years ago
Closed 9 years ago
MP3Demuxer downloads the whole file before doing anything
Categories
(Core :: Audio/Video: Playback, defect)
Tracking
()
RESOLVED
FIXED
mozilla43
Tracking | Status | |
---|---|---|
firefox43 | --- | fixed |
People
(Reporter: jya, Assigned: esawin)
References
Details
Attachments
(1 file, 1 obsolete file)
1.25 KB,
patch
|
esawin
:
review+
|
Details | Diff | Splinter Review |
Playing the MP3 found there:
http://podiobooks.com/title/a-coffee-crusade/
which is:
http://hwcdn.libsyn.com/p/f/4/3/f434e89b9a46f426/PB-CoffeeCrusade-01.mp3?c_id=536624&expiration=1439435909&hwt=d0c27a2d14831297bf6fa729755ddf55
After demuxing the first frame, I see the demuxer downloading and parsing the entire content ; only to return an error that it has reached EOS.
It should only parsed content as it arrives upon a call to NotifyDataArrived
It shouldn't attempt to read the entire file.
Updated•9 years ago
|
Assignee | ||
Comment 1•9 years ago
|
||
This is not a recent regression, playback on this site has been broken for a long time (before the introduction of the new MP3Demuxer).
The most likely cause for this is that the stream is malformed or not recognizable as an MP3 stream for other reasons, which would explain the behaviour.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Comment 2•9 years ago
|
||
Playback on podiobooks.com seems to have been broken for a long time, however that MP3 file itself looks like a recent regression to me as well.
On FF40, it's showing up with a length of 39:01 and playback works, on Nightly on the other hand it's appearing with a length of 22:41:13 (!) and playback doesn't work.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Reporter | ||
Comment 3•9 years ago
|
||
plays fine with the AppleMP3Reader
Reporter | ||
Comment 4•9 years ago
|
||
Couldn't we abort early after failing to decode some samples after a few MB?
downloading the entire file (here over 30MB) seems like excessive
Reporter | ||
Updated•9 years ago
|
Status: REOPENED → RESOLVED
Closed: 9 years ago → 9 years ago
Resolution: --- → DUPLICATE
Reporter | ||
Comment 6•9 years ago
|
||
actually, I think the issue is more generic than this particular mp3 not playing.
it's not about that it's not playing, but that an non recognised file is downloaded in it's entirety.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Assignee | ||
Comment 7•9 years ago
|
||
(In reply to Jean-Yves Avenard [:jya] from comment #6)
> actually, I think the issue is more generic than this particular mp3 not
> playing.
>
> it's not about that it's not playing, but that an non recognised file is
> downloaded in it's entirety.
That's a good point. We should abort parsing after X bytes parsed without a successful frame detection.
Assignee | ||
Comment 8•9 years ago
|
||
With this patch, we abort frame parsing after reading 12kB (minus detected ID3 header size) without detecting the first frame header.
Attachment #8648097 -
Flags: review?(jyavenard)
Assignee | ||
Comment 9•9 years ago
|
||
(In reply to JanH from comment #2)
> Playback on podiobooks.com seems to have been broken for a long time,
> however that MP3 file itself looks like a recent regression to me as well.
> On FF40, it's showing up with a length of 39:01 and playback works, on
> Nightly on the other hand it's appearing with a length of 22:41:13 (!) and
> playback doesn't work.
This is worth investigating, too. On which platform are you testing this? On FF40 for Android, I only get the option to download the MP3 file, it won't play it in the browser.
Assignee | ||
Updated•9 years ago
|
OS: Unspecified → Android
Hardware: Unspecified → All
Comment 10•9 years ago
|
||
Yes, I was testing on Android and for me, the file opened directly within the browser. Maybe downloading it to your device and opening it via a file:// URL works for you?
Assignee | ||
Comment 11•9 years ago
|
||
(In reply to JanH from comment #10)
> Yes, I was testing on Android and for me, the file opened directly within
> the browser. Maybe downloading it to your device and opening it via a
> file:// URL works for you?
We're not registered to handle that intent, so opening the file with FF won't be an option.
I can only get the URL to open directly in the browser in FF41+, where it fails to play.
Comment 12•9 years ago
|
||
That's weird. Even on Firefox 40, I can simply type e.g. /storage/extSdCard/Music into the URL bar, which shows the directory listing for that folder on my phone. I can then pick any MP3 file at random, and it's starts playing using Firefox's internal player.
Which Android version are you using?
Reporter | ||
Comment 13•9 years ago
|
||
(In reply to Eugen Sawin [:esawin] from comment #8)
> Created attachment 8648097 [details] [diff] [review]
> 0001-Bug-1194085-Abort-frame-parsing-if-no-valid-audio-st.patch
>
> With this patch, we abort frame parsing after reading 12kB (minus detected
> ID3 header size) without detecting the first frame header.
what's the logic behind the choice of 12kB?
Assignee | ||
Comment 14•9 years ago
|
||
> what's the logic behind the choice of 12kB?
There is no particular logic behind it, I've just increased the heuristic length from 1x buffer size from the old frame parser to 3x to give the parser some more leeway in the case of a failed detection of an (long but realistic) ID3 header.
Pushing the value much higher up won't give us more reliability, since a single buffer read (4kB) should contain at least 2 complete audio frames.
Reporter | ||
Comment 15•9 years ago
|
||
Comment on attachment 8648097 [details] [diff] [review]
0001-Bug-1194085-Abort-frame-parsing-if-no-valid-audio-st.patch
Review of attachment 8648097 [details] [diff] [review]:
-----------------------------------------------------------------
this still seems super short to me..
but if you think that's sufficient.
How will this handle a case where we have a valid audio and suddenly some corruption in the stream and then valid again?
Attachment #8648097 -
Flags: review?(jyavenard) → review+
Assignee | ||
Comment 16•9 years ago
|
||
> this still seems super short to me..
>
> but if you think that's sufficient.
>
> How will this handle a case where we have a valid audio and suddenly some
> corruption in the stream and then valid again?
We can safely increase the value, if you prefer. It's difficult to say what's best without knowing the probability and characteristics of stream corruptions.
The mechanics from the patch would not abort reading once we've identified it as a MP3 stream, so mid-stream corruptions would be simply skipped over. Only corruptions before the first frame could break the parsing if we pass the 12kB limit of unidentifiable stream data.
As for regular non-corrupted streams which don't form valid MPEG audio, the minimum required range that needs to be parsed to identify it is ID3-header-size[10 bytes] + ID3-data-size[<=256MB] + frame-header-size[4 bytes]. With the maximum ID3 data size being practically unbound, we can not use it as a base for our value.
Assignee | ||
Comment 17•9 years ago
|
||
The patch does not count the ID3-data-size from comment 16 towards the 12kB. Which means that the ID3 header parsing is critical, since a wrongly identified ID3 tag size may abort the parsing pre-maturely.
Due to the unbound max ID3 tag size, the only way to prevent aborting in such a case would be to accept a valid ID3 header as validation for the stream, without requiring parsing a valid MPEG frame. But that would mean we would parse streams (until EOS) which might not contain any MPEG frames.
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → esawin
Assignee | ||
Comment 18•9 years ago
|
||
Increased MAX_SKIPPED_BYTES from 3x to 10x buffer size (40kB) addressing review comment.
Attachment #8648097 -
Attachment is obsolete: true
Attachment #8649433 -
Flags: review+
Comment 19•9 years ago
|
||
Comment 20•9 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 9 years ago → 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in
before you can comment on or make changes to this bug.
Description
•