From 75b213ed5425c7ca8be92c88d96effc73d0d9bbc Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 5 Mar 2007 17:54:49 +0000 Subject: [PATCH] prevent audio packets from being fragmented, wmp mac doesnt seem to like that and microshitty also doesnt seem to ever fragment them Originally committed as revision 8265 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/asf-enc.c | 8 +++++++- tests/ffmpeg.regression.ref | 8 ++++---- tests/libav.regression.ref | 6 +++--- tests/rotozoom.regression.ref | 8 ++++---- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/libavformat/asf-enc.c b/libavformat/asf-enc.c index 6c0ec59be8..7e53ffdd00 100644 --- a/libavformat/asf-enc.c +++ b/libavformat/asf-enc.c @@ -648,6 +648,7 @@ static void put_payload_header( static void put_frame( AVFormatContext *s, ASFStream *stream, + AVStream *avst, int timestamp, const uint8_t *buf, int m_obj_size, @@ -677,6 +678,11 @@ static void put_frame( frag_len1 = asf->packet_size_left - PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS - PACKET_HEADER_MIN_SIZE - 1; asf->packet_timestamp_start = timestamp; + + if(frag_len1 < payload_len && avst->codec->codec_type == CODEC_TYPE_AUDIO){ + flush_packet(s); + continue; + } } if (frag_len1 > 0) { if (payload_len > frag_len1) @@ -731,7 +737,7 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt) asf->duration= FFMAX(asf->duration, duration); packet_st = asf->nb_packets; - put_frame(s, stream, pkt->dts, pkt->data, pkt->size, flags); + put_frame(s, stream, s->streams[pkt->stream_index], pkt->dts, pkt->data, pkt->size, flags); /* check index */ if ((!asf->is_streamed) && (flags & PKT_FLAG_KEY)) { diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref index b61ece94bd..b599a08c8d 100644 --- a/tests/ffmpeg.regression.ref +++ b/tests/ffmpeg.regression.ref @@ -188,11 +188,11 @@ c3382f03ce2efb5d475240d288a33898 *./data/a-flac.flac 353368 ./data/a-flac.flac c4228df189aad9567a037727d0e763e4 *./data/out.wav stddev: 33.31 PSNR:65.87 bytes:1040384 -885affac24b064633c17d92ea23bbe3a *./data/a-wmav1.asf -99604 ./data/a-wmav1.asf +0c406c4e4586ca27064e28637b662631 *./data/a-wmav1.asf +106004 ./data/a-wmav1.asf stddev:12251.50 PSNR:14.56 bytes:1056768 stddev:2106.00 PSNR:29.85 bytes:1048576 -cf5d1f5ed52230ee3b92efd53f59a668 *./data/a-wmav2.asf -99644 ./data/a-wmav2.asf +82442aaa5fdbd327769e4c4ad369147e *./data/a-wmav2.asf +106044 ./data/a-wmav2.asf stddev:12255.92 PSNR:14.55 bytes:1056768 stddev:2099.31 PSNR:29.88 bytes:1048576 diff --git a/tests/libav.regression.ref b/tests/libav.regression.ref index a843fea5f2..6c245658b5 100644 --- a/tests/libav.regression.ref +++ b/tests/libav.regression.ref @@ -2,7 +2,7 @@ ffmpeg regression test 8a0536ccfe36f4fff408b3327d33e1dd *./data/b-libav.avi 340344 ./data/b-libav.avi ./data/b-libav.avi CRC=0x400c29e9 -a41bf92d0756cec87288583175f6b5a9 *./data/b-libav.asf +786446e80ead936e5faa8f5908f19281 *./data/b-libav.asf 339775 ./data/b-libav.asf ./data/b-libav.asf CRC=0x74113749 1ad618e9fd318eb3483270cf9b9b3f43 *./data/b-libav.rm @@ -10,8 +10,8 @@ a41bf92d0756cec87288583175f6b5a9 *./data/b-libav.asf bdb7484c68db722f66ba1630cf79844c *./data/b-libav.mpg 378880 ./data/b-libav.mpg ./data/b-libav.mpg CRC=0x2b71a386 -0bf8fb3b4d7bb70ed89356e94cd8ffa2 *./data/b-libav.ts -471316 ./data/b-libav.ts +322d59758fe9446147223a607d1699bc *./data/b-libav.ts +471692 ./data/b-libav.ts ./data/b-libav.ts CRC=0xcc4948e1 d6fdeb9f7083cc827f9510c6c4517dc0 *./data/b-libav.swf 335771 ./data/b-libav.swf diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref index bd980585a1..897d9266a0 100644 --- a/tests/rotozoom.regression.ref +++ b/tests/rotozoom.regression.ref @@ -188,11 +188,11 @@ c3382f03ce2efb5d475240d288a33898 *./data/a-flac.flac 353368 ./data/a-flac.flac c4228df189aad9567a037727d0e763e4 *./data/out.wav stddev: 33.31 PSNR:65.87 bytes:1040384 -885affac24b064633c17d92ea23bbe3a *./data/a-wmav1.asf -99604 ./data/a-wmav1.asf +0c406c4e4586ca27064e28637b662631 *./data/a-wmav1.asf +106004 ./data/a-wmav1.asf stddev:12251.50 PSNR:14.56 bytes:1056768 stddev:2106.00 PSNR:29.85 bytes:1048576 -cf5d1f5ed52230ee3b92efd53f59a668 *./data/a-wmav2.asf -99644 ./data/a-wmav2.asf +82442aaa5fdbd327769e4c4ad369147e *./data/a-wmav2.asf +106044 ./data/a-wmav2.asf stddev:12255.92 PSNR:14.55 bytes:1056768 stddev:2099.31 PSNR:29.88 bytes:1048576