[vlc-commits] demux: mp4: fix reading stsd v2 sample rate
Francois Cartegnie
git at videolan.org
Thu Apr 6 11:02:48 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Apr 6 11:01:53 2017 +0200| [ed565218e021d11e3df0728e030e4d6e43f8e2fa] | committer: Francois Cartegnie
demux: mp4: fix reading stsd v2 sample rate
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ed565218e021d11e3df0728e030e4d6e43f8e2fa
---
modules/demux/mp4/libmp4.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index ebf3627..8d2701c 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -2354,8 +2354,9 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET8BYTES( i_dummy64 );
memcpy( &f_sample_rate, &i_dummy64, 8 );
msg_Dbg( p_stream, "read box: %f Hz", f_sample_rate );
- p_box->data.p_sample_soun->i_sampleratehi = (int)f_sample_rate % BLOCK16x16;
- p_box->data.p_sample_soun->i_sampleratelo = f_sample_rate / BLOCK16x16;
+ /* 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 = (uint32_t)f_sample_rate;
+ p_box->data.p_sample_soun->i_sampleratelo = (f_sample_rate - p_box->data.p_sample_soun->i_sampleratehi);
MP4_GET4BYTES( i_channel );
p_box->data.p_sample_soun->i_channelcount = i_channel;
More information about the vlc-commits
mailing list