[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-datatype-cvs
Subject:    [Datatype-cvs] mp4/fileformat/pub qtatmmgs.h,1.21,1.22
From:       ehyche () helixcommunity ! org
Date:       2008-04-29 5:45:37
Message-ID: 200804290546.m3T5kWT1031532 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/datatype/mp4/fileformat/pub
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv10362/pub

Modified Files:
	qtatmmgs.h 
Log Message:
Description
-------------------------------------------------
In mp4 files, samples can be stored in chunks, which
are contiguous blocks on media data. In order to tell
which samples belong to which chunks, there's a 
sample-to-chunk table which tells how many samples
are in each chunk:

  Chunk     NumberOfSamples
    1             31
    2             31
    3             31
    4             32
    5             32
    6             31
   ...

Since lots of times consecutive chunks have the same
number of samples, then this table is stored in compact fashion,
and only the first chunk is stored in the table for 
a run of chunks with the same number of samples.
For the example above, the table above would be stored
like this:

FirstChunk     NumberOfSamples
    1             31
    4             32
    6             31
   ...

which means that chunks 1-3 have 31 samples each,
chunks 4-5 have 32 samples each, etc. Therefore, in almost
all files I have seen up until now, the FirstChunk field
in the table is STRICTLY INCREASING. However, the mp4 file
format spec does not specifically prohibit duplicated entries
in the table. I have attached an image of a "normal"
sample-to-chunk table (normal_stsc.png).

However, in hc.org bug 7975, Intel discovered some content
where there are duplicated entries in the sample-to-chunk
table (see attached image odd_stsc.png). This duplicated entry
uncovered a bug in the CQT_SampleToChunk_Manager class in
the mp4 file format plugin. These duplicated entries were causing
us to produce a packet of the correct size but from the wrong
offset in the file. This was resulting in garbage packets
being handed to the AAC decoder.

This changes enables the CQT_SampleToChunk_Manager class to
handle duplicated entries in the sample-to-chunk table. It
does this by not assuming that the next entry in the table
will be valid, but rather introduces two new functions to
search for valid entries: GetNextFirstChunk() and GetPrevFirstChunk().
It also cleans up some code which was duplicated in several
places by centralizing these code in three new functions:
GetFirstChunk(), GetSamplesPerChunk(), and GetSampleDescID().

Files Modified
-------------------------------------------------
datatype/mp4/fileformat/qtatmmgs.cpp
datatype/mp4/fileformat/pub/qtatmmgs.h

Branches
-------------------------------------------------
HEAD and hxclient_3_1_0_atlas

Testing
-------------------------------------------------
I tested playback and seeking on files with duplicated
sample-to-chunk entries (the repro content) as well as
files with no duplicated sample-to-chunk entries.



Index: qtatmmgs.h
===================================================================
RCS file: /cvsroot/datatype/mp4/fileformat/pub/qtatmmgs.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- qtatmmgs.h	24 Mar 2008 06:32:45 -0000	1.21
+++ qtatmmgs.h	29 Apr 2008 05:45:35 -0000	1.22
@@ -208,6 +208,11 @@
 private:
     HXBOOL SequenceToChunk(void);
     inline HXBOOL SequenceReverseToChunk(void);
+    ULONG32       GetFirstChunk(ULONG32 i);
+    ULONG32       GetSamplesPerChunk(ULONG32 i);
+    ULONG32       GetSampleDescID(ULONG32 i);
+    ULONG32       GetNextFirstChunk(ULONG32 i, ULONG32& rulNextIdx);
+    ULONG32       GetPrevFirstChunk(ULONG32 i, ULONG32& rulPrevIdx);
 
     CQT_stsc_Atom* m_pSampleToChunkAtom;
 
@@ -216,6 +221,7 @@
     ULONG32 m_ulCurrentChunk;
     ULONG32 m_ulNextEntryChunk;
     ULONG32 m_ulCurrentEntryIdx;
+    ULONG32 m_ulNextEntryIdx;
     ULONG32 m_ulSamplesPerChunk;
     ULONG32 m_ulSampleNumber;
     ULONG32 m_ulSampleDescIdx;


_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic