comparison libmpdemux/asfheader.c @ 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 f418c82bd502
children 139f2b064ef9
comparison
equal deleted inserted replaced
33403:02ef77592b7d 33404:7dfe52e4f2e1
541 (int)fileh->min_packet_size, (int)fileh->max_packet_size, 541 (int)fileh->min_packet_size, (int)fileh->max_packet_size,
542 (int)fileh->max_bitrate, (int)fileh->preroll); 542 (int)fileh->max_bitrate, (int)fileh->preroll);
543 asf->packetsize=fileh->max_packet_size; 543 asf->packetsize=fileh->max_packet_size;
544 asf->packet=malloc(asf->packetsize); // !!! 544 asf->packet=malloc(asf->packetsize); // !!!
545 asf->packetrate=fileh->max_bitrate/8.0/(double)asf->packetsize; 545 asf->packetrate=fileh->max_bitrate/8.0/(double)asf->packetsize;
546 asf->movielength=(fileh->play_duration-10000*fileh->preroll)/10000000.0; 546 asf->movielength=FFMAX(0.0, (fileh->play_duration / 10000.0 - fileh->preroll) / 1000.0);
547 } 547 }
548 548
549 // find content header 549 // find content header
550 pos = find_asf_guid(hdr, asf_content_desc_guid, 0, hdr_len); 550 pos = find_asf_guid(hdr, asf_content_desc_guid, 0, hdr_len);
551 if (pos >= 0) { 551 if (pos >= 0) {