Commit Graph

45 Commits

Author SHA1 Message Date
Eugen Sawin
a614659c6d Bug 1267862 - [1.2] Implement MP3Demuxer::GetBuffered independent of stream length and total duration. r=jya 2016-05-03 15:16:51 +02:00
Jan Henning
e1bbdff4b6 Bug 1263334 - Check VBR header is valid before using it for duration calculations. r=esawin
MozReview-Commit-ID: KPrn5WeXUuF

--HG--
extra : transplant_source : E%89%8Cs%1BG%28y%B82%3E%F8%CB%A8Q%B3%1F%EB%94%C2
2016-04-09 20:38:45 +02:00
Jan Henning
4c248c7249 Bug 1256590 - Part 1 - Try detecting the actual frame start even when parsing starts mid-stream. r=esawin
So far we've simply assumed that the first MPEG Layer 3 frame sync we find is automatically valid. However if the audio data has been improperly cut, parsing might start somewhere in mid-stream, so the first frame sync we hit upon might be a false positive. This naturally leads to problems if we try to check later frame syncs for consistency (same MPEG version, sample rate, etc.) with that first frame sync.

Therefore, this patch changes demuxer initialisation to only accept a frame sync if it is followed by a number of further frame syncs consistent with the initial frame.
2016-03-22 21:39:05 +01:00
Jan Henning
4bb019056c Bug 1257931 - Fix assert in VBRI header parsing to actually check that we've been passed a reader starting with a frame sync. r=esawin 2016-03-18 17:17:20 +01:00
Joel Maher
be768c0a8d Bug 1250635 - remove ENABLE_TESTS from dom/media cpp files. r=esawin
MozReview-Commit-ID: D6T1253vNwP

--HG--
extra : rebase_source : a247b10446bf8aaa03f0aad55d4c451aad3c2fe2
2016-02-23 12:04:27 -08:00
Eugen Sawin
d69c074e5e Bug 1236639 - [1.2] Avoid division by zero in MP3Demuxer. r=gerald 2016-01-08 16:19:43 +01:00
Chris Peterson
1577f5cd77 Bug 1235232 - Fix -Wclass-varargs warnings in dom/media/. r=kentuckyfriedtakahe
dom/media/ADTSDemuxer.cpp:481:10 [-Wclass-varargs] passing object of class type 'const media::TimeUnit' through variadic function
dom/media/ADTSDemuxer.cpp:513:11 [-Wclass-varargs] passing object of class type 'const media::TimeUnit' through variadic function
dom/media/ADTSDemuxer.cpp:526:14 [-Wclass-varargs] passing object of class type 'const media::TimeUnit' through variadic function
dom/media/ADTSDemuxer.cpp:527:23 [-Wclass-varargs] passing object of class type 'media::TimeUnit' through variadic function
dom/media/ADTSDemuxer.cpp:532:11 [-Wclass-varargs] passing object of class type 'const media::TimeUnit' through variadic function

dom/media/MP3Demuxer.cpp:201:10 [-Wclass-varargs] passing object of class type 'const mozilla::media::TimeUnit' through variadic function
dom/media/MP3Demuxer.cpp:237:10 [-Wclass-varargs] passing object of class type 'const mozilla::media::TimeUnit' through variadic function
dom/media/MP3Demuxer.cpp:256:13 [-Wclass-varargs] passing object of class type 'const mozilla::media::TimeUnit' through variadic function
dom/media/MP3Demuxer.cpp:257:22 [-Wclass-varargs] passing object of class type 'media::TimeUnit' through variadic function
dom/media/MP3Demuxer.cpp:262:10 [-Wclass-varargs] passing object of class type 'const mozilla::media::TimeUnit' through variadic function
2015-12-22 18:44:31 -08:00
Eugen Sawin
61cdb4a6cd Bug 1219178 - [9.1] Make SeekPosition available with tests disabled. a=me for fixing build problems 2015-11-25 06:44:00 +01:00
Eugen Sawin
607c52ca89 Bug 1219178 - [8.1] Constrain seek position getter to max duration. r=jya 2015-11-24 15:02:35 +01:00
Eugen Sawin
4356ebc299 Bug 1219178 - [4.1] Accept only layer III frames. r=jya 2015-11-24 15:02:34 +01:00
Eugen Sawin
c389d0fb93 Bug 1219178 - [3.1] Clamp seeking offsets to estimated frame boundaries. r=jya 2015-11-24 15:02:33 +01:00
Eugen Sawin
3bc9e20c06 Bug 1219178 - [2.1] Add frame consistency verification to reduce chance for false positive detection. r=jya 2015-11-24 15:02:33 +01:00
Eugen Sawin
f4295dd666 Bug 1219178 - [1.1] Prevent ScanUntil from overshooting the target time frame. r=jya 2015-11-24 15:02:32 +01:00
Eugen Sawin
121337c4af Bug 1217802 - [2.1] Return 0 for incomplete ID3 header size. r=jya 2015-11-23 22:30:34 +01:00
Eugen Sawin
1ffefee100 Bug 1217802 - [1.1] Decrease buffer size when scanning for next frame. r=jya 2015-11-23 22:30:34 +01:00
sajitk
582e1a55fa Bug 1219480 - Replace PRLogModuleInfo with LazyLogModule in the media directory. r=rillian 2015-11-15 14:49:01 +01:00
Wes Kocher
f3a9eb2a26 Backed out changeset 1e5f3d1151d6 (bug 1219480) for cpp unittest bustage CLOSED TREE
--HG--
extra : commitid : BMVKq6cPeho
2015-11-11 09:36:56 -08:00
sajitk
3cbe348cdd Bug 1219480 - Replace PRLogModuleInfo with LazyLogModule in the media directory. r=rillian
--HG--
extra : rebase_source : c73098485fa005d914304fb6e7f8eba3c15e66dc
2015-11-11 06:52:00 +01:00
Eugen Sawin
26ead9d2d6 Bug 1163667 - [4.3] Use VBR/CBR header TOC for efficient seeking and enable fast seeking without TOC based on average frame sizes. r=jya 2015-10-26 18:30:53 +01:00
Eugen Sawin
72014fde27 Bug 1163667 - [3.3] Parse complete Xing/Info header info. r=jya 2015-10-26 18:30:52 +01:00
Eugen Sawin
2faf158f48 Bug 1163667 - [1.1] Shorten logging macro. r=jya 2015-10-26 18:30:52 +01:00
Nathan Froyd
01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Jean-Yves Avenard
628247fc4e Bug 1212176: Remove arguments passed to MediaDataDemuxer::NotifyDataArrived API. r=cpearce
Be more explicit on what it does and how it should be used.
2015-10-08 20:47:21 +11:00
Jan Henning
1e4aec48b4 Bug 1202286 - Part 2 - Switch VBR header parsing to use a ByteReader as well instead of directly accessing the buffer. r=esawin
This also contains two small fixes to the VBR header parsing logic itself:
- VBRI parsing was previously broken because the offset wasn't calculated correctly.
- Xing-style headers can use a VBR header ID of "Info" as well.

--HG--
extra : rebase_source : 320a5e7b50e16ab3382e7121dd3d41f5fc439b76
2015-10-04 18:51:40 +02:00
Jan Henning
39b1643cc7 Bug 1202286 - Part 1 - Switch the MPEG frame and ID3 header parsers to use a ByteReader instead of accessing the input buffer directly. r=esawin
--HG--
extra : rebase_source : 4d3c6e1d5f6655163bf59fcdc4238f3740e107d2
2015-10-03 20:36:46 +02:00
Jan Henning
7db0ee08cb Bug 1202286 - Part 0 - Add some explicit namespace references to keep the compiler and IntelliSense happy. r=esawin
DecoderTraits.cpp pulls in MP3Demuxer.h which in turn pulls in mp4_demuxer/ByteReader.h. In that context, for some reason the ByteReader can't find the definition for MediaByteBuffer unless it is prefixed with the proper namespace.

MP3Demuxer.cpp itself compiles fine, but for some reason in Visual Studio IntelliSense complains about TimeUnit and TimeIntervals being undefined unless the using statement uses the full namespace hierarchy.

Also fix a small typo.

--HG--
extra : rebase_source : fc46fc82bf06b61c9ac31c2f4331f84f8557c51e
2015-10-01 11:29:48 +02:00
Jean-Yves Avenard
3c833c2162 Bug 1194080: [mp3] Implement MP3TrackDemuxer::GetBuffered(). r=esawin
This is done by roughly estimated the duration of the MediaResource buffered range from the average bitrate.
2015-10-02 12:41:06 +10:00
Jean-Yves Avenard
759f764945 Bug 1207924: [mp3] P1. Fix MP3 decoding with early version of LibAV. r=esawin
LibAV 0.8 incorrectly set the pts as dts ; so we must set the dts to ensure not all frames have a time of 0.
2015-10-02 12:41:05 +10:00
Jean-Yves Avenard
abc4fb6966 Bug 1207119: [mp3] Properly read channels count. r=esawin
The channel count is stored on bit 6 & 7 of byte at offset 3.
2015-09-27 15:19:27 +10:00
Jan Henning
2814fb3119 Bug 1203217 - Add some logging when we detect and skip an ID3v2 tag. r=kinetik
This also cleans up the indentation for some of the already existing logging.
2015-09-13 14:33:49 +02:00
Jean-Yves Avenard
023ff53978 Bug 1204757: P1. Update MediaDataDemuxer::Init() behavior. r=cpearce
A MediaDataDemuxer is now not to resolve the init promise until it has all the metadata.
Except MediaSource, all demuxers would be doing blocking read to scan for the metadata, and having partial metadata would be an error.
For MediaSource, we pass the NotifyDataArrived message which will cause the MediaSourceDemuxer to re-attempt to search for the metadata.

When used within MediaSource's TrackBuffersManager, a demuxer will never be created until we have received a complete init segment (this task is performed by the various ContainerParsers)
2015-09-16 18:14:17 +10:00
Jean-Yves Avenard
33e5945370 Bug 1204407: P2. Remove no longer required MediaDataDemuxer APIs. r=cpearce 2015-09-16 18:14:15 +10:00
Jean-Yves Avenard
71c5c9a7bf Bug 1204419: P4. Remove MediaDataDemuxer API no longer used. r=cpearce 2015-09-16 18:14:12 +10:00
Jan Henning
7e0079f5ec Bug 1197985 - Part 2 - Prevent potential overflows of the input buffer pointer when skipping large ID3 headers. r=esawin 2015-09-04 18:00:09 +02:00
Jan Henning
aa608ef285 Bug 1197985 - Part 1 - Successfully skip ID3 tags stretching beyond the current input buffer. r=esawin
This also slightly tightens up invalid header detection for both ID3 and MPEG frame headers.
2015-09-07 19:18:31 +02:00
Eugen Sawin
5f0d2e47a6 Bug 1194085 - Abort frame parsing if no valid audio stream is found. r=jya 2015-08-18 20:49:58 +02:00
Jean-Yves Avenard
4775a405d3 Bug 1191813: [mp3] P1. Avoid false positive EOS detection. r=esawin
We do so by using blocking reads via the MediaSourceIndex::ReadAt convenience method.
2015-08-15 00:22:00 +10:00
Jean-Yves Avenard
8c8e3b2a70 Bug 1190258: P1. Use getter to access MediaRawData mData and mSize member. r=cpearce 2015-08-06 18:48:44 +10:00
Eugen Sawin
7066fe2b35 Bug 1191281 - Increase strictness of ID3 header detection. r=ehoogeveen 2015-08-05 17:57:00 +02:00
Eugen Sawin
0a159166d5 Bug 1190897 - Add MP3Demuxer logging. r=kinetik 2015-08-05 13:39:52 +02:00
Eugen Sawin
b9e633ac47 Bug 1190558 - Add MP3 track demuxer seek tests. r=kinetik 2015-08-04 23:01:36 +02:00
Eugen Sawin
1c5bef0343 Bug 1190558 - Reset MP3 frame parser on track demuxer reset. r=kinetik 2015-08-04 23:01:36 +02:00
Birunthan Mohanathas
a8939590de Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Eugen Sawin
22da02745d Bug 1169142 - Fix MP3 demuxer initialization for resources with unknown content lengths. r=kinetik 2015-07-06 21:06:11 +02:00
Eugen Sawin
e03391c07e Bug 1166779 - Rebase MP3 demuxer on MediaDataDemuxer interface. r=kinetik
--HG--
rename : media/libstagefright/binding/MP3TrackDemuxer.cpp => dom/media/MP3Demuxer.cpp
rename : media/libstagefright/binding/include/mp4_demuxer/MP3TrackDemuxer.h => dom/media/MP3Demuxer.h
extra : rebase_source : 1cbc9b841cdba57e9d72c00f6c6ec95eebb3b371
2015-06-05 14:34:19 +02:00