Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
2f1601e0 by Martin Finkel at 2026-01-09T11:43:23+00:00
Revert "demux: libmp4: read Qt double sample rate in one call"

This reverts commit 6aab1e0b2b25971eb2e217c93b68a5ca831f5334.

MP4_COPY_BYTES does a raw memcpy without endianness conversion.
QuickTime Sound Description V2 stores the sample rate as a big-endian
64-bit IEEE 754 double. On little-endian systems (Windows, Android ARM,
etc.), this results in a garbage sample rate value, causing PCM audio
playback to fail with "bad samplerate: 0 Hz".

The original code using MP4_GET8BYTES + memcpy correctly handles the
big-endian to native conversion.

- - - - -


1 changed file:

- modules/demux/mp4/libmp4.c


Changes:

=====================================
modules/demux/mp4/libmp4.c
=====================================
@@ -2698,6 +2698,7 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, 
MP4_Box_t *p_box )
     {
         /* SoundDescriptionV2 */
         double f_sample_rate;
+        int64_t i_dummy64;
         uint32_t i_channel, i_extoffset, i_dummy32;
 
         /* Checks */
@@ -2714,7 +2715,8 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, 
MP4_Box_t *p_box )
         /* !Checks */
 
         MP4_GET4BYTES( i_extoffset ); /* offset to stsd extensions */
-        MP4_COPY_BYTES( f_sample_rate, 8 );
+        MP4_GET8BYTES( i_dummy64 );
+        memcpy( &f_sample_rate, &i_dummy64, 8 );
         msg_Dbg( p_stream, "read box: %f Hz", f_sample_rate );
         /* Rounding error with lo, but we don't care since we do not support 
fractional audio rate */
         p_box->data.p_sample_soun->i_sampleratehi = (uint16_t)f_sample_rate;



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/2f1601e03a40137f9a2168249c420a508733a444

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


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to