changeset 34827:ef7be22beabe

Take start offset into account when calculating amount of audio data. Patch by Benot Thbaudeau [benoit thebaudeau advansee com]
author reimar
date Fri, 18 May 2012 17:03:09 +0000
parents 26d77af0f13a
children becaa4804918
files libmpdemux/demux_audio.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_audio.c	Fri May 18 17:01:13 2012 +0000
+++ b/libmpdemux/demux_audio.c	Fri May 18 17:03:09 2012 +0000
@@ -792,7 +792,8 @@
 
 static int demux_audio_control(demuxer_t *demuxer,int cmd, void *arg){
     sh_audio_t *sh_audio=demuxer->audio->sh;
-    int audio_length = sh_audio->i_bps ? demuxer->movi_end / sh_audio->i_bps : 0;
+    int audio_length = sh_audio->i_bps && demuxer->movi_end > demuxer->movi_start ?
+                       (demuxer->movi_end - demuxer->movi_start) / sh_audio->i_bps : 0;
     da_priv_t* priv = demuxer->priv;
 
     switch(cmd) {