Skip to content

demux: mp4: read one sample each time for opus

Zhao Zhili requested to merge quink/vlc:bugfix-mp4 into master

There is a file which has two mp4 sample per chunk. The master branch has no problem since i_bytes_per_frame is zero.

            if( i_samples_per_frame && i_bytes_per_frame )
            {
                /* GSM, ADPCM,  */
                if( i_samples_per_frame > 64 &&
                    i_samples_per_frame > i_bytes_per_frame )
                {
                    *pi_nb_samples = i_samples_per_frame;
                    i_size = i_bytes_per_frame;
                }
                else
                {
                    /* Regular cases */
                    uint32_t i_frames = __MAX(i_max_v0_samples / i_samples_per_frame, 1);
                    *pi_nb_samples = i_frames * i_samples_per_frame;
                    i_size = i_frames * i_bytes_per_frame;
                }
            }
            else
            {
                *pi_nb_samples = 1;
                return p_track->i_sample_size;
            }

It's the 3.0 branch has real problem:

[00007fe64d53e2a0] main audio output warning: playback too early (-40033): down-sampling
[00007fe64d53e2a0] main audio output warning: timing screwed (drift: -100012 us): stopping resampling
[00007fe64d53e2a0] main audio output warning: playback way too early (-120014): playing silence
[00007fe64d53e2a0] main audio output debug: inserting 5760 zeroes
[00007fe64d53e2a0] main audio output warning: playback too early (-59862): down-sampling
[00007fe64d53e2a0] main audio output warning: timing screwed (drift: -119862 us): stopping resampling
[00007fe64d53e2a0] main audio output warning: playback way too early (-139862): playing silence
[00007fe64d53e2a0] main audio output debug: inserting 6713 zeroes
...

MP4_TrackGetReadSize() in master branch and 3.0 branch have a lot of small differences, the patch is for minimum modification.

Merge request reports

Loading