Commit 055b369d authored by Francois Cartegnie's avatar Francois Cartegnie

demux: mp4: remove the arbitrary QT_MAX_V0_SAMPLES

Fixes alaw regression.
/samples/A-codecs/aLaw/
Arbitrary limit still required for compressed format(AMR).
Now max to read 25ms of samples.
parent 3f3e7231
...@@ -3023,7 +3023,6 @@ static inline uint32_t MP4_GetFixedSampleSize( const mp4_track_t *p_track, ...@@ -3023,7 +3023,6 @@ static inline uint32_t MP4_GetFixedSampleSize( const mp4_track_t *p_track,
return i_size; return i_size;
} }
#define QT_V0_MAX_SAMPLES 1024
static uint32_t MP4_TrackGetReadSize( mp4_track_t *p_track, uint32_t *pi_nb_samples ) static uint32_t MP4_TrackGetReadSize( mp4_track_t *p_track, uint32_t *pi_nb_samples )
{ {
uint32_t i_size = 0; uint32_t i_size = 0;
...@@ -3105,6 +3104,24 @@ static uint32_t MP4_TrackGetReadSize( mp4_track_t *p_track, uint32_t *pi_nb_samp ...@@ -3105,6 +3104,24 @@ static uint32_t MP4_TrackGetReadSize( mp4_track_t *p_track, uint32_t *pi_nb_samp
} }
/* uncompressed v0 (qt) or... not (ISO) */ /* uncompressed v0 (qt) or... not (ISO) */
uint32_t i_max_v0_samples;
switch( p_track->fmt.i_codec )
{
/* Compressed samples in V0 */
case VLC_CODEC_AMR_NB:
case VLC_CODEC_AMR_WB:
i_max_v0_samples = 16;
break;
default:
/* Read 25ms of samples (uncompressed) */
i_max_v0_samples = p_track->fmt.audio.i_rate / 40 *
p_track->fmt.audio.i_channels;
if( i_max_v0_samples < 1 )
i_max_v0_samples = 1;
break;
}
*pi_nb_samples = 0; *pi_nb_samples = 0;
for( uint32_t i=p_track->i_sample; for( uint32_t i=p_track->i_sample;
i<p_chunk->i_sample_first+p_chunk->i_sample_count && i<p_chunk->i_sample_first+p_chunk->i_sample_count &&
...@@ -3124,18 +3141,8 @@ static uint32_t MP4_TrackGetReadSize( mp4_track_t *p_track, uint32_t *pi_nb_samp ...@@ -3124,18 +3141,8 @@ static uint32_t MP4_TrackGetReadSize( mp4_track_t *p_track, uint32_t *pi_nb_samp
break; break;
} }
switch( p_track->fmt.i_codec ) if ( *pi_nb_samples == i_max_v0_samples )
{ break;
case VLC_CODEC_AMR_NB:
case VLC_CODEC_AMR_WB:
if ( *pi_nb_samples == 16 )
i = UINT32_MAX;
break;
default:
if ( *pi_nb_samples == QT_V0_MAX_SAMPLES )
i = UINT32_MAX;
break;
}
} }
} }
......
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