changeset 33404:7dfe52e4f2e1

Fix play duration calculation error. Acording to the ASF documentation, the play duration is zero if the preroll value is greater than the play duration. The new way of determination (suggested by reimar) prevents overflows as well.
author ib
date Tue, 24 May 2011 13:35:26 +0000
parents 02ef77592b7d
children d2e61ef877d2
files libmpdemux/asfheader.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/asfheader.c	Tue May 24 08:20:48 2011 +0000
+++ b/libmpdemux/asfheader.c	Tue May 24 13:35:26 2011 +0000
@@ -543,7 +543,7 @@
       asf->packetsize=fileh->max_packet_size;
       asf->packet=malloc(asf->packetsize); // !!!
       asf->packetrate=fileh->max_bitrate/8.0/(double)asf->packetsize;
-      asf->movielength=(fileh->play_duration-10000*fileh->preroll)/10000000.0;
+      asf->movielength=FFMAX(0.0, (fileh->play_duration / 10000.0 - fileh->preroll) / 1000.0);
   }
 
   // find content header