Bug 831224: Remove trailing whitespaces, r=padenot

--HG--
extra : rebase_source : e04ddb59ab953550d988924670c96b73bf7909f2
Bug 831224: Added MP3 frame parser, r=padenot

MP3 streams consist of small frames, with each frame containing the
audio data of a few hundred milliseconds. The actual duration of the
encoded audio can among frames.

Each frame consists of a 4-byte frame header, some optional extra
information, and the audio data. The MP3 frame parser walks over the
content of an MP3 stream, computes the duration of each frame from
the frame header, and sums them up to the streams complete duration.

The MP3 frame parser does not decode the actual audio data.

--HG--
extra : rebase_source : 1b101d8f9bf73e62672933d0f5d20253d7b25491
Bug 831224: Allow update of the media duration, r=padenot

With MP3 streams, the media duration might change after we received
new data. This patch adds infrastructure to signal the new duration
to the media decoder and state machine. It will also fire an event
of type 'durationchange' to the DOM.

--HG--
extra : rebase_source : f417b968e81d9c9a1aff8ae3174079a297eb371b
Bug 831224: Parse MP3 frame headers in OmxDecoder, r=padenot

On FirefoxOS, the Android libraries estimate the duration of MP3 streams
by examining the first MP3 frame header. This only works for streams with
constant bit rate. For streams with variable bit rate, a too short or too
long duration is computed.

This patch adds support for parsing MP3 frame headers. The decoder handles
file streams by reading them at once at the beginning and parsing them
immediately. Network streams are updated when a new fragment arrives.

--HG--
extra : rebase_source : bffb9447a5fdba4145e83f5aeb3c2accfb7872d6
Bug 831224: Use multi-threaded I/O for reading and processing MP3 frames, r=padenot

Reading large MP3 files from a slow medium, such as an SD card, takes
several seconds. This is too long for interactive applications like the
music app.

With this patch, the OmxDecoder reads large MP3 file in smaller chunks
and hands over each chunk individually to the MP3 parser. Reading the
file is done in the I/O thread, which is allowed to block, parsing is
done on the main thread.

The current chunk size is 8 MiB, which is small enough to not cause any
delay.

--HG--
extra : rebase_source : 4effb86db481c405a97760cd98f4218dde42104d
Bug 831224: Added mochitest for variable-bitrate MP3s, r=padenot

The test checks the duration of an MP3 file with variable bitrate. The
MP3 file only contains silence. It uses a high bit-rate encoding for its
first half, a low bit-rate encoding for its second half. The correct
duration is 10 seconds, but an incorrect implementation will return a
much shorter value.

--HG--
extra : rebase_source : f62cf69a631a276c4e6e96e827ab615367cad877