Commit Graph

56 Commits

Author SHA1 Message Date
trav90 d9cca66809 Prevent microseconds calculation overflow 2018-07-25 07:00:09 +08:00
trav90 2fe117fe1e [mp4] Remove parsing of creation date
We don't care about it for our use.
Additionally, gmtime and strftime are not thread safe at all and are potential crash points.
2018-07-25 06:59:50 +08:00
trav90 0e42c5d8c5 Crash fix: Check for overflow and that conversion succeeded 2018-07-25 06:59:48 +08:00
trav90 a8910c103e [mp4] Don't reject boxes that contains padding but can be easily skipped 2018-07-25 06:59:46 +08:00
trav90 b0dd7fbdd9 [mp4] Skip four bytes when we hit a zero length box 2018-07-25 06:42:30 +08:00
trav90 4f8e7a5731 Revert "Properly handle MP4 time offset in MoofParser" 2018-07-25 06:36:46 +08:00
trav90 ee6bb9e25d Revert "MP4 dts must use the same timeline as pts" 2018-07-25 06:36:44 +08:00
trav90 cd3cf81bba Rebase MP3 demuxer on MediaDataDemuxer interface 2018-07-25 06:35:47 +08:00
trav90 f466cc6b5a Add MP3 track demuxer 2018-07-25 06:35:45 +08:00
trav90 78948cd873 Silence another useless "error" message in libstagefright 2018-07-25 06:24:42 +08:00
trav90 ba52868b6b Change "error" in MPEG4Extractor into verbose only
This "error" appears in the terminal all the time when not using GStreamer to play MP4. It serves no purpose anymore and is a remnant of when stagefright would allocate a static buffer and do all its work there.
2018-07-25 06:24:10 +08:00
trav90 9a6b3eb6b1 Use getter to access MediaRawData mData and mSize member 2018-07-25 01:31:17 +08:00
trav90 77aa7347d9 Fix build bustage in MPEG4Extractor header 2018-07-25 01:30:52 +08:00
trav90 5867d296b1 Ignore non-supported entries in edit list 2018-07-25 01:30:50 +08:00
trav90 0e08420f9c MP4 dts must use the same timeline as pts 2018-07-25 01:30:49 +08:00
trav90 02bb611252 Properly handle MP4 time offset in MoofParser 2018-07-25 01:30:47 +08:00
trav90 f7d3c3fea9 Properly handle MP4 starting offset 2018-07-25 01:30:45 +08:00
trav90 e86fca9ea3 Crash fix: Disable use of stagefright::String8::clear
Some parts of stagefright::String8 aren't threadsafe as they make use of static shared objects.
2018-07-25 01:30:43 +08:00
trav90 8cfee64c42 Properly set dts on plain MP4 media
This fixes a problem of frames being displayed out of order with some versions of LibAV/FFmpeg.
2018-07-25 01:30:41 +08:00
trav90 61cdb3ae72 Use MediaLargeByteBuffer, not MediaByteBuffer 2018-07-25 01:28:30 +08:00
trav90 91fb55b087 Do not allocate memory spanning across MP4 ftyp and moov atom
A typical non-fragmented mp4 would have the ftyp atom located at the beginning of the mp4 and the moov at the end. We would to calculate the location of the metadata by spanning the byte range of the two atoms. As such, we would typically allocate an amount of memory equivalent to the size of the mp4.

Instead we now reconstruct the metadata to only have the ftyp and moov atoms contiguously.
2018-07-25 01:28:19 +08:00
trav90 df0a9e3ddb Ignore invalid MP4 tracks 2018-07-25 01:28:10 +08:00
trav90 22c7029347 Never do blocking read if we don't have data 2018-07-25 01:28:01 +08:00
trav90 c78d266df2 Include ftyp box when parsing init segment 2018-07-25 01:21:33 +08:00
trav90 9a20ef534c Extend BufferStream to work with external buffer array
Also make BufferStream::AppendBytes fallible.
2018-07-25 01:21:30 +08:00
trav90 7cddfbff3c Add MP4Metadata method to retrieve init segment byte range 2018-07-25 01:21:28 +08:00
trav90 e210003812 Use MediaRawDataWriter to access MediaRawData::mCrypto
This is to make it consistent with accessing mData.
2018-07-25 01:21:22 +08:00
trav90 5faffc0065 Parse all trun boxes in MP4 fragments, not just the first one 2018-07-25 01:19:27 +08:00
trav90 e0fec017f3 Remove invalid assertion in MoofParser 2018-07-25 01:19:25 +08:00
trav90 8f2ed1c967 Crash fix: Use fallible array to store MP4 samples index 2018-07-25 01:19:23 +08:00
trav90 850786d1e4 Replace instance of stagefright::Vector with nsTArray 2018-07-25 01:19:21 +08:00
trav90 a6f5fdc72f Fix another typo 2018-07-25 01:19:19 +08:00
trav90 0a855126b2 Add support for the mp4v-es MPEG-4 codec 2018-07-25 01:19:17 +08:00
trav90 de98fbe9c5 Make stagefright work on big-endian systems 2018-07-25 01:19:14 +08:00
trav90 66e89e2014 Use QTv2 header when available 2018-07-25 01:19:12 +08:00
trav90 d6335febb4 Rename LargeDataBuffer and DataBuffer objects
This prevents conflicts and crashes with WebRTC libs that use those names already. Some linkers appear to get it wrong and calls the destructor of the wrong class.
2018-07-25 01:19:09 +08:00
trav90 1bd24949dc Properly handle box size marked as 0
This indicates that the box goes to the end of the file.
2018-07-25 01:19:07 +08:00
trav90 594cf3f51b Remove unused header 2018-07-25 01:19:00 +08:00
trav90 c39022c3c5 Use new MoofParser::HasMetadata in MP4Metadata
This allows MP4Reader::ReadMetadata() to not be unecessarily blocking on partial init segment.
2018-07-25 01:18:58 +08:00
trav90 610a9e101b Add MoofParser::HasMetadata method
Allows to check if we have a full MP4 metadata's atom available in our stream.
2018-07-25 01:18:56 +08:00
trav90 1c861007ca Add ResourceStream class
A Stream abstract over a MediaResource.
2018-07-25 01:18:54 +08:00
trav90 a2daa59046 Add MP4Metadata class
This allows us to abstract the calls to libstagefright and allows future replacement with our own code.
2018-07-25 01:18:53 +08:00
trav90 52d5912e97 Remove MP4 Index's libstagefright dependency 2018-07-25 01:18:47 +08:00
trav90 cf43ead582 Remove mp4_demuxer::TrackType 2018-07-25 01:18:45 +08:00
trav90 8d99c39267 Remove redundant mHasAudio/mHasVideo member 2018-07-25 01:18:39 +08:00
trav90 a5a1590505 Use AudioInfo/VideoInfo object
This removes remaining references to stagefright/MP4 specific objects.
2018-07-25 01:18:35 +08:00
trav90 6755d0bc55 Use new MediaRawObject across the board 2018-07-25 01:18:27 +08:00
trav90 a09289133e Create new MediaRawData object type
This object extends MediaData and will be used to contain demuxed compressed data.
2018-07-25 01:18:25 +08:00
trav90 cbf0070896 Fix constness and remove use of reference to refcounted ptr 2018-07-25 01:18:23 +08:00
trav90 d346235b7e Remove libstagefright dependencies from Crypto config 2018-07-25 01:18:21 +08:00