[vlc-commits] [Git][videolan/vlc][master] demux: mp4: use aout_bitspersample to set PCM read size

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Apr 19 14:30:37 UTC 2026



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
3462acc0 by François Cartegnie at 2026-04-19T15:56:48+02:00
demux: mp4: use aout_bitspersample to set PCM read size

Reverses logic using the list of known uncompressed codecs
instead of trying to list every compressed case

- - - - -


1 changed file:

- modules/demux/mp4/mp4.c


Changes:

=====================================
modules/demux/mp4/mp4.c
=====================================
@@ -4360,22 +4360,20 @@ static uint32_t MP4_TrackGetReadSize( mp4_track_t *p_track, uint32_t *pi_nb_samp
             case VLC_CODEC_AMR_WB:
                 i_max_v0_samples = 16;
                 break;
-            case VLC_CODEC_MPGA:
-            case VLC_CODEC_MP2:
-            case VLC_CODEC_MP3:
-            case VLC_CODEC_DTS:
-            case VLC_CODEC_MP4A:
-            case VLC_CODEC_A52:
-            case VLC_CODEC_OPUS:
-                i_max_v0_samples = 1;
-                break;
-                /* fixme, reverse using a list of uncompressed codecs */
             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 )
+                if( aout_BitsPerSample(p_track->fmt.i_codec) )
+                {
+                    /* 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;
+                }
+                else
+                {
+                    /* compressed codecs */
                     i_max_v0_samples = 1;
+                }
                 break;
         }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3462acc0a9cb484d610b7631e623862c02ab78d7

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3462acc0a9cb484d610b7631e623862c02ab78d7
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list