Closed
Bug 1039639
Opened 10 years ago
Closed 9 years ago
Add support for Flac on Firefox OS
Categories
(Firefox OS Graveyard :: Gaia::Music, defect)
Firefox OS Graveyard
Gaia::Music
Tracking
(firefox39 fixed, b2g-v1.4 wontfix, b2g-v2.0 wontfix, b2g-v2.0M wontfix, b2g-v2.1 wontfix, b2g-v2.2 wontfix, b2g-master affected)
People
(Reporter: zefling, Assigned: squib)
References
Details
(Whiteboard: [ft:media] [2.2 target][mozfr-community])
Attachments
(2 files, 1 obsolete file)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0 (Beta/Release) Build ID: 20140611125853 Steps to reproduce: I passed my Micro SD card of my android phone on Flame. All my music on my android phone is in Flac and unplayable. Actual results: Currently, the Flac audio format isn't support on Firefox OS. Expected results: Add the Flac audio format support on Firefox OS.
I can confirm that FLAC is also unsupported on my HEAD build of Firefox OS on flame. Apple lossless (ALAC) is also not supported.
I can confirm as well on Flame (Firefox OS 2.1)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 3•10 years ago
|
||
Storage API needs to be updated for FLAC. See bug 1059903.
Depends on: 1059903
Comment 4•10 years ago
|
||
Part of this, we'd need to add support for FLAC metadata (mostly like VorbisComment).
Comment 5•10 years ago
|
||
+1 let me know what I can do to help test this. I have some flac on my SD card now that's not showing up and I update my phone pretty regularly (rebuilding after a `./repo sync`); I'd be happy to work with someone on squashing this one.
Comment 6•10 years ago
|
||
So I tried renaming my .flac files to .flac.mp3 (per the comment here: https://github.com/nazar-pc/CleverStyle-Music/issues/3#issuecomment-53760443, I could've also just renamed them to .mp3). The result in the built in player was that they work (as in I can play them), but there's no metadata (so all flac shows up under 'Unknown artist'). I'm not sure if that means more work, or if the built-in music app will "just work" after https://bugzilla.mozilla.org/show_bug.cgi?id=1059903 is fixed.
Comment 7•10 years ago
|
||
As someone with a large library of music in FLAC format, I would welcome not having to transcode to a lossy format in order to use a Firefox phone as a music player with metadata. There are a couple of additional benefits which were not mentioned above... 1. Decoding FLAC is likely to use less CPU/battery than decoding any lossy format (see the graphs at the end of the page http://www.hydrogenaud.io/forums/index.php?showtopic=92235) 2. Many hi-fi companies are supporting FLAC as an open standard format (https://en.wikipedia.org/wiki/List_of_hardware_and_software_that_supports_FLAC#Others), so having FLAC metadata support on the phone would enable them to create Firefox OS apps which integrate with their systems.
Assignee | ||
Comment 8•10 years ago
|
||
(In reply to randomenduser from comment #6) > So I tried renaming my .flac files to .flac.mp3 ... The result in the built in > player was that they work (as in I can play them)... This works for me too. What the hell is going on here? I guess we can just take advantage of that, although I really want to know why this works (notably, it doesn't work at all on Firefox desktop, which is where I was testing this). (In reply to daniel.james from comment #7) > 1. Decoding FLAC is likely to use less CPU/battery than decoding any lossy > format (see the graphs at the end of the page > http://www.hydrogenaud.io/forums/index.php?showtopic=92235) That's just not true. The main difference is that MP3s use a hardware decoder which consumes quite a bit less battery. Anyway, give me a couple of days to land bug 1089718 and then it should be a simple matter to fully-support FLAC (or at least, as much as we support Vorbis, anyway).
Assignee | ||
Comment 9•10 years ago
|
||
I still need to write tests, and we need to make deviceStorage recognize FLAC (bug 1059903), but if you're ok with farting around with file extensions, this pull request should parse FLAC metadata (but no album art yet).
Assignee: nobody → squibblyflabbetydoo
Status: NEW → ASSIGNED
Comment 10•10 years ago
|
||
> > So I tried renaming my .flac files to .flac.mp3 ... The result in the built in > > player was that they work (as in I can play them)... > > This works for me too. What the hell is going on here? Some players will reject a file as unplayable based on the extension alone, without looking at the mimetype, before attempting to decode them. It saves throwing an error later. I'll take a wild guess that this is the cause here. > > 1. Decoding FLAC is likely to use less CPU/battery than decoding any lossy > > format (see the graphs at the end of the page > > http://www.hydrogenaud.io/forums/index.php?showtopic=92235) > > That's just not true. The main difference is that MP3s use a hardware > decoder which consumes quite a bit less battery. I was not aware that the Flame phone contained an MP3 hardware decoder. Thanks for your work on the pull request.
Comment 11•10 years ago
|
||
Thanks for the quick turnaround! I'll try to build and flash your branch this weekend and let you know how it goes.
Assignee | ||
Comment 12•10 years ago
|
||
(In reply to daniel.james from comment #10) > > > So I tried renaming my .flac files to .flac.mp3 ... The result in the built in > > > player was that they work (as in I can play them)... > > > > This works for me too. What the hell is going on here? > > Some players will reject a file as unplayable based on the extension alone, > without looking at the mimetype, before attempting to decode them. It saves > throwing an error later. I'll take a wild guess that this is the cause here. The "what the hell" was because Gecko doesn't actually have any FLAC code at all, but after talking to some people, apparently there's a FLAC decoder in the Gonk layer.
Comment 13•10 years ago
|
||
(In reply to Jim Porter (:squib) from comment #12) > (In reply to daniel.james from comment #10) > > > > So I tried renaming my .flac files to .flac.mp3 ... The result in the built in > > > > player was that they work (as in I can play them)... > > > > > > This works for me too. What the hell is going on here? > > > > Some players will reject a file as unplayable based on the extension alone, > > without looking at the mimetype, before attempting to decode them. It saves > > throwing an error later. I'll take a wild guess that this is the cause here. > > The "what the hell" was because Gecko doesn't actually have any FLAC code at > all, but after talking to some people, apparently there's a FLAC decoder in > the Gonk layer. Bug 992756 may be helpful to you. Yes. Currently FFOS leverages libstagefright's decoder via MediaOmxReader.
Updated•10 years ago
|
Whiteboard: [ft:media] [2.2 target]
Target Milestone: --- → 2.2 S1 (5dec)
Assignee | ||
Comment 14•10 years ago
|
||
Comment on attachment 8518458 [details] [review] Parse FLAC metadata Here's the Gaia side to FLAC support. David, I think you'll find this much simpler to review than my last metadata patch. :)
Attachment #8518458 -
Flags: review?(dflanagan)
Assignee | ||
Comment 15•10 years ago
|
||
This is currently untested, but it's really simple. I'll try to test this out myself later today, or possibly Monday.
Attachment #8527017 -
Flags: review?(dhylands)
Comment 16•10 years ago
|
||
Comment on attachment 8527017 [details] [diff] [review] Support FLAC in Gecko Review of attachment 8527017 [details] [diff] [review]: ----------------------------------------------------------------- ::: netwerk/mime/nsMimeTypes.h @@ +79,4 @@ > #define AUDIO_MP3 "audio/mpeg" > #define AUDIO_MP4 "audio/mp4" > #define AUDIO_AMR "audio/amr" > +#define AUDIO_FLAC "audio/flac" This isn't official yet according to http://www.iana.org/assignments/media-types/media-types.xhtml#audio Does it matter? (Also, I note that amr is audio/AMR in uppercase) Should audio/amr and audio/flac be ifdeffed like they are in the cpp file?
Comment 17•10 years ago
|
||
Comment on attachment 8518458 [details] [review] Parse FLAC metadata A few nits on github, but otherwise it looks good. Too bad that you couldn't reuse the existing vorbis comment parsing code. But given how short it is, it doesn't seem worth the time to refactor it into a form where it could be shared.
Attachment #8518458 -
Flags: review?(dflanagan) → review+
Comment 18•10 years ago
|
||
Comment on attachment 8527017 [details] [diff] [review] Support FLAC in Gecko Review of attachment 8527017 [details] [diff] [review]: ----------------------------------------------------------------- Where does the flac codec live? If it requires OMX to do the decoding then I think we'll need more changes. See bug 986331 DecoderTraits.cpp is now in dom/media. You should get cajbir to review
Attachment #8527017 -
Flags: review?(dhylands)
Comment 19•10 years ago
|
||
(In reply to David Flanagan [:djf] from comment #16) > Comment on attachment 8527017 [details] [diff] [review] > Support FLAC in Gecko > > Review of attachment 8527017 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: netwerk/mime/nsMimeTypes.h > @@ +79,4 @@ > > #define AUDIO_MP3 "audio/mpeg" > > #define AUDIO_MP4 "audio/mp4" > > #define AUDIO_AMR "audio/amr" > > +#define AUDIO_FLAC "audio/flac" > > This isn't official yet according to > http://www.iana.org/assignments/media-types/media-types.xhtml#audio > > Does it matter? It doesn't matter. One is supposed to use audio/x-flac until audio/flac is registered, but that just means one has to support _two_ mime types. Flac has been deployed for 13 years. No other codec is going to appear with a better claim for the official registration.
Assignee | ||
Comment 20•10 years ago
|
||
Ok, I think this is right. I'm not entirely sure I got the tests right; they pass, but I'm not 100% what's getting tested...
Attachment #8527017 -
Attachment is obsolete: true
Attachment #8531373 -
Flags: review?(cajbir.bugzilla)
Updated•10 years ago
|
Attachment #8531373 -
Flags: review?(cajbir.bugzilla) → review+
Assignee | ||
Comment 21•10 years ago
|
||
I'm out right now, but this can probably land; I just don't have time to watch the tree after landing myself...
Keywords: checkin-needed
Comment 22•10 years ago
|
||
Release Note Request (optional, but appreciated) [Why is this notable]: [Suggested wording]: [Links (documentation, blog post, etc)]:
status-b2g-v1.4:
--- → wontfix
status-b2g-v2.0:
--- → wontfix
status-b2g-v2.0M:
--- → wontfix
status-b2g-v2.1:
--- → wontfix
Updated•10 years ago
|
Keywords: checkin-needed
Updated•10 years ago
|
status-b2g-v2.2:
--- → affected
Keywords: checkin-needed
Updated•10 years ago
|
Keywords: checkin-needed
Comment 23•10 years ago
|
||
Pull request has landed in master: https://github.com/mozilla-b2g/gaia/commit/17f58f7754df1f9b572b12a89fefb72131b954fd
Updated•10 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Comment 24•10 years ago
|
||
We still need the Gecko patch.
Updated•10 years ago
|
Status: REOPENED → ASSIGNED
Comment 25•10 years ago
|
||
https://hg.mozilla.org/integration/b2g-inbound/rev/0460160af653
Flags: in-testsuite+
Keywords: checkin-needed
Updated•10 years ago
|
Comment 26•10 years ago
|
||
Backed out for crashes. https://hg.mozilla.org/integration/b2g-inbound/rev/09bf82baf421 https://treeherder.mozilla.org/logviewer.html#?job_id=976986&repo=b2g-inbound
Comment 27•10 years ago
|
||
Looks like other tests were hitting similar issues. Make sure this gets a full green B2G mochitest run (opt and debug) before re-landing.
Assignee | ||
Comment 28•10 years ago
|
||
:cajbir, any ideas why this might crash? I know next to nothing about how Gecko talks to libstagefright.
Flags: needinfo?(cajbir.bugzilla)
Comment 29•10 years ago
|
||
They were timeouts that were force-crashed to get a stack, in case that helps.
Comment 30•10 years ago
|
||
Buggy flac decoder in Stagefright maybe? The crash looks to be inside the actual stagefright flac decoder code.
Flags: needinfo?(cajbir.bugzilla)
Assignee | ||
Comment 31•10 years ago
|
||
What's the way forward then? Disable the tests?
Flags: needinfo?(cajbir.bugzilla)
Comment 32•10 years ago
|
||
The way forward is for someone to debug exactly what's causing the crash, and what devices it occurs on. Then a decision would need to be made if we need to disable it on crashy devices and enable it on working ones. It may be something we are doing wrong in calling stagefright that triggers it too.
Flags: needinfo?(cajbir.bugzilla)
Comment 33•10 years ago
|
||
Sotaro may be able to help with identification of the reason for the crash.
Flags: needinfo?(sotaro.ikeda.g)
Comment 34•10 years ago
|
||
(In reply to cajbir (:cajbir) from comment #33) > Sotaro may be able to help with identification of the reason for the crash. I can help it, but it becomes tomorrow(17th). Is it OK?
Comment 35•10 years ago
|
||
re-check tryserver result. https://treeherder.mozilla.org/#/jobs?repo=try&revision=28191f14e618 https://tbpl.mozilla.org/?tree=Try&rev=28191f14e618
Flags: needinfo?(sotaro.ikeda.g)
Comment 36•10 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro PTO Dec/24-Jan/6] from comment #35) > re-check tryserver result. > https://treeherder.mozilla.org/#/jobs?repo=try&revision=28191f14e618 > https://tbpl.mozilla.org/?tree=Try&rev=28191f14e618 test failure happens only on debug build and there seems no problem on flame and hamachi devices. Therefore, FLACParser's algorithm seems not have a problem.
Comment 37•10 years ago
|
||
The following is disassemble of copyStereo16() ------------------------------------------------ Dump of assembler code for function copyStereo16: 406 { 0x432f6aec <+0>: push {r4, lr} 407 for (unsigned i = 0; i < nSamples; ++i) { => 0x432f6aee <+2>: movs r3, #0 0x432f6af0 <+4>: b.n 0x432f6b08 <copyStereo16+28> 0x432f6b02 <+22>: adds r3, #1 0x432f6b08 <+28>: adds r0, #4 0x432f6b0a <+30>: cmp r3, r2 0x432f6b0c <+32>: bne.n 0x432f6af2 <copyStereo16+6> 408 *dst++ = src[0][i]; 0x432f6af2 <+6>: ldr r4, [r1, #0] 0x432f6af4 <+8>: ldrh.w r12, [r4, r3, lsl #2] 0x432f6af8 <+12>: strh.w r12, [r0, #-4] 409 *dst++ = src[1][i]; 0x432f6afc <+16>: ldr r4, [r1, #4] 0x432f6afe <+18>: ldrh.w r4, [r4, r3, lsl #2] 0x432f6b04 <+24>: strh.w r4, [r0, #-2] 410 } 411 } 0x432f6b0e <+34>: pop {r4, pc} End of assembler dump.
Comment 38•10 years ago
|
||
Crash address seems always 0x50. It is r4's value. From the following code, r4 is source address. ---------------------------------------------- 12:53:04 INFO - Crash reason: SIGSEGV 12:53:04 INFO - Crash address: 0x50 12:53:04 INFO - Thread 26 (crashed) 12:53:04 INFO - 0 libstagefright.so!android::copyStereo16 [FLACExtractor.cpp : 409 + 0x2] 12:53:04 INFO - r4 = 0x00000050 r5 = 0x00000001 r6 = 0x00000000 r7 = 0x467f8000 12:53:04 INFO - r8 = 0x00000004 r9 = 0x42643157 r10 = 0x42643170 fp = 0x002e2761 12:53:04 INFO - sp = 0x46ea8b50 lr = 0x4313d621 pc = 0x4313d176
Comment 39•10 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro PTO Dec/24-Jan/6] from comment #38) > Crash address seems always 0x50. It is r4's value. From the following code, > r4 is source address. Source buffer is come from FLAC library.
Comment 40•10 years ago
|
||
I could re-generate the crash by using long flac music file and do seek in Music app.
Comment 41•10 years ago
|
||
Implementation of FLACParser seems to have a problem. It seems better to handle it in a new bug. I am going to create a bug for it.
Updated•10 years ago
|
blocking-b2g: --- → 2.2?
Comment 42•9 years ago
|
||
AFAIK, FLAC support is not a blocking feature for 2.2. Removing from blocking nom
blocking-b2g: 2.2? → ---
Comment 43•9 years ago
|
||
i want FLAC support aswell for next version if you could do it, as most of my music is in FLAC, any list of supported audio or video formats //Martin "bittin" Jernberg
Comment 44•9 years ago
|
||
+1 Please add FLAC support, since most torrents are encoded using FLAC nowadays (*irony*)
Assignee | ||
Comment 45•9 years ago
|
||
There's no need to add "me too" comments to this bug. It already has patches and is just waiting for some platform fixes to land before I check in the final bit that fully-enables FLAC. Please be patient.
Assignee | ||
Comment 46•9 years ago
|
||
Since bug 1113271 is fixed, I think we can try landing this again.
Keywords: checkin-needed
Comment 47•9 years ago
|
||
Can we get a Try run to confirm that first? :)
Flags: needinfo?(squibblyflabbetydoo)
Keywords: checkin-needed
Updated•9 years ago
|
status-b2g-master:
--- → affected
Target Milestone: 2.2 S1 (5dec) → ---
Assignee | ||
Comment 48•9 years ago
|
||
Finally got around to pushing to try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=76959dd0683c
Flags: needinfo?(squibblyflabbetydoo)
Assignee | ||
Comment 49•9 years ago
|
||
I think the tests look ok. There are a couple of failures, but they seem to be unrelated. (The closest seems to be a couple of failures for video playback on Windows, but I don't think that's related to this.)
Keywords: checkin-needed
Comment 50•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/f19216bba031
Keywords: checkin-needed
Comment 51•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/f19216bba031
Status: ASSIGNED → RESOLVED
Closed: 10 years ago → 9 years ago
status-firefox39:
--- → fixed
Resolution: --- → FIXED
Whiteboard: [ft:media] [2.2 target] → [ft:media] [2.2 target][mozfr-community]
You need to log in
before you can comment on or make changes to this bug.
Description
•