Commit afc9003f authored by Francois Cartegnie's avatar Francois Cartegnie

demux: mp4: fix grouped compressed samples reading (fix #11601)

parent 0e89cd61
......@@ -3359,7 +3359,6 @@ static uint32_t MP4_TrackGetReadSize( mp4_track_t *p_track, uint32_t *pi_nb_samp
const MP4_Box_data_sample_soun_t *p_soun = p_track->p_sample->data.p_sample_soun;
const mp4_chunk_t *p_chunk = &p_track->chunk[p_track->i_chunk];
uint32_t i_max_samples = p_chunk->i_sample_count - p_chunk->i_sample + 1;
i_max_samples = __MIN( i_max_samples, QT_V0_MAX_SAMPLES );
/* Group audio packets so we don't call demux for single sample unit */
if( p_track->fmt.i_original_fourcc == VLC_CODEC_DVD_LPCM &&
......@@ -3383,12 +3382,15 @@ static uint32_t MP4_TrackGetReadSize( mp4_track_t *p_track, uint32_t *pi_nb_samp
if( p_soun->i_qt_version == 1 )
{
if ( p_soun->i_compressionid != 0 )
if ( p_soun->i_compressionid != 0 || p_soun->i_bytes_per_sample > 1 ) /* compressed */
{
/* in this case we are dealing with compressed data
-2 in V1: additional fields are meaningless (VBR and such) */
i_size = p_track->i_sample_size;
*pi_nb_samples = 1;
*pi_nb_samples = i_max_samples;//p_track->chunk[p_track->i_chunk].i_sample_count;
if( p_track->fmt.audio.i_blockalign > 1 )
*pi_nb_samples = p_soun->i_sample_per_packet;
i_size = *pi_nb_samples / p_soun->i_sample_per_packet * p_soun->i_bytes_per_frame;
return i_size;
}
else /* uncompressed case */
{
......@@ -3403,10 +3405,11 @@ static uint32_t MP4_TrackGetReadSize( mp4_track_t *p_track, uint32_t *pi_nb_samp
*pi_nb_samples = i_packets * p_soun->i_sample_per_packet;
i_size = i_packets * p_soun->i_bytes_per_frame;
return i_size;
}
}
/* uncompressed */
/* uncompressed v0 */
*pi_nb_samples = 0;
for( uint32_t i=p_track->i_sample;
i<p_chunk->i_sample_first+p_chunk->i_sample_count &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment