summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-02-09 20:49:12 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-02-09 20:49:12 +0000
commit2d241e6687202ceca5edc7c9a82fa23b3111a2c1 (patch)
treeff4a1ba7d095026a0e81dc1afcd05ffaf533b2d8
parentcf10ee184f721d3b9539f5e6d79de19704d8c52d (diff)
downloadffmpeg-streaming-2d241e6687202ceca5edc7c9a82fa23b3111a2c1.zip
ffmpeg-streaming-2d241e6687202ceca5edc7c9a82fa23b3111a2c1.tar.gz
fix broken memset(padding, 0) code
add a few asserts Originally committed as revision 7903 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/asf-enc.c16
-rw-r--r--tests/ffmpeg.regression.ref8
-rw-r--r--tests/libav.regression.ref2
-rw-r--r--tests/rotozoom.regression.ref8
4 files changed, 19 insertions, 15 deletions
diff --git a/libavformat/asf-enc.c b/libavformat/asf-enc.c
index fe4df8e..50c282d 100644
--- a/libavformat/asf-enc.c
+++ b/libavformat/asf-enc.c
@@ -537,6 +537,11 @@ static int put_payload_parsing_info(
int iLengthTypeFlags = ASF_PPI_LENGTH_TYPE_FLAGS;
+ padsize -= PACKET_HEADER_MIN_SIZE;
+ if(asf->multi_payloads_present)
+ padsize--;
+ assert(padsize>=0);
+
put_byte(pb, ASF_PACKET_ERROR_CORRECTION_FLAGS);
for (i = 0; i < ASF_PACKET_ERROR_CORRECTION_DATA_SIZE; i++){
put_byte(pb, 0x0);
@@ -587,7 +592,8 @@ static void flush_packet(AVFormatContext *s)
asf->packet_size_left
);
- packet_filled_size = PACKET_SIZE - packet_hdr_size - asf->packet_size_left;
+ packet_filled_size = PACKET_SIZE - asf->packet_size_left;
+ assert(packet_hdr_size <= asf->packet_size_left);
memset(asf->packet_buf + packet_filled_size, 0, asf->packet_size_left);
put_buffer(&s->pb, asf->packet_buf, asf->packet_size - packet_hdr_size);
@@ -656,20 +662,18 @@ static void put_frame(
if (asf->packet_timestamp_start == -1) {
asf->multi_payloads_present = (payload_len < MULTI_PAYLOAD_CONSTANT);
+ asf->packet_size_left = PACKET_SIZE;
if (asf->multi_payloads_present){
- asf->packet_size_left = PACKET_SIZE; //For debug
- asf->packet_size_left = PACKET_SIZE - PACKET_HEADER_MIN_SIZE - 1;
frag_len1 = MULTI_PAYLOAD_CONSTANT - 1;
}
else {
- asf->packet_size_left = PACKET_SIZE - PACKET_HEADER_MIN_SIZE;
frag_len1 = SINGLE_PAYLOAD_DATA_LENGTH;
}
asf->packet_timestamp_start = timestamp;
}
else {
// multi payloads
- frag_len1 = asf->packet_size_left - PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS;
+ frag_len1 = asf->packet_size_left - PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS - PACKET_HEADER_MIN_SIZE - 1;
asf->packet_timestamp_start = timestamp;
}
@@ -697,7 +701,7 @@ static void put_frame(
if (!asf->multi_payloads_present)
flush_packet(s);
- else if (asf->packet_size_left <= (PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS + 1))
+ else if (asf->packet_size_left <= (PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS + PACKET_HEADER_MIN_SIZE + 1))
flush_packet(s);
}
stream->seq++;
diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref
index 0f1c508..134ee5d 100644
--- a/tests/ffmpeg.regression.ref
+++ b/tests/ffmpeg.regression.ref
@@ -188,17 +188,17 @@ c3382f03ce2efb5d475240d288a33898 *./data/a-flac.flac
353368 ./data/a-flac.flac
c4228df189aad9567a037727d0e763e4 *./data/out.wav
stddev: 33.31 PSNR:65.87 bytes:1040384
-9fe59eb60481009f6f7d13d1b031975d *./data/a-wmav1.asf
+768305cec342e01b7a9d38e971ef0174 *./data/a-wmav1.asf
99596 ./data/a-wmav1.asf
2ab193df22bb473e61015e56ac11faf3 *./data/out.wav
stddev:12251.50 PSNR:14.56 bytes:1056768
stddev:2106.00 PSNR:29.85 bytes:1048576
-ff09659af56c931350db4dec737eea7f *./data/a-wmav2.asf
+c706c7cf9db10df7a7353a40feddcfdd *./data/a-wmav2.asf
99602 ./data/a-wmav2.asf
8d05d345bc14153f3d0da95fdf34e084 *./data/out.wav
stddev:12255.92 PSNR:14.55 bytes:1056768
stddev:2099.31 PSNR:29.88 bytes:1048576
-e56c2c60b025594eac3ba670ae3cc50d *./data/a-vorbis.asf
+ef725cb9c13b9437a41428eabadeba52 *./data/a-vorbis.asf
35686 ./data/a-vorbis.asf
-295d828df6167db030d0812ce1a8fd93 *./data/out.wav
+e46368ef818f2ec3abcc3f8390d14df5 *./data/out.wav
stddev:3882.46 PSNR:24.54 bytes:1056768
diff --git a/tests/libav.regression.ref b/tests/libav.regression.ref
index 79ee93e..06c7be7 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
-af76964183b72ab3e18f1581e55950db *./data/b-libav.asf
+149792fc0d4e5ccb395c47716e2975d9 *./data/b-libav.asf
339767 ./data/b-libav.asf
./data/b-libav.asf CRC=0x74113749
1ad618e9fd318eb3483270cf9b9b3f43 *./data/b-libav.rm
diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref
index 04c356d..84aa891 100644
--- a/tests/rotozoom.regression.ref
+++ b/tests/rotozoom.regression.ref
@@ -188,17 +188,17 @@ c3382f03ce2efb5d475240d288a33898 *./data/a-flac.flac
353368 ./data/a-flac.flac
c4228df189aad9567a037727d0e763e4 *./data/out.wav
stddev: 33.31 PSNR:65.87 bytes:1040384
-9fe59eb60481009f6f7d13d1b031975d *./data/a-wmav1.asf
+768305cec342e01b7a9d38e971ef0174 *./data/a-wmav1.asf
99596 ./data/a-wmav1.asf
2ab193df22bb473e61015e56ac11faf3 *./data/out.wav
stddev:12251.50 PSNR:14.56 bytes:1056768
stddev:2106.00 PSNR:29.85 bytes:1048576
-ff09659af56c931350db4dec737eea7f *./data/a-wmav2.asf
+c706c7cf9db10df7a7353a40feddcfdd *./data/a-wmav2.asf
99602 ./data/a-wmav2.asf
8d05d345bc14153f3d0da95fdf34e084 *./data/out.wav
stddev:12255.92 PSNR:14.55 bytes:1056768
stddev:2099.31 PSNR:29.88 bytes:1048576
-e56c2c60b025594eac3ba670ae3cc50d *./data/a-vorbis.asf
+ef725cb9c13b9437a41428eabadeba52 *./data/a-vorbis.asf
35686 ./data/a-vorbis.asf
-295d828df6167db030d0812ce1a8fd93 *./data/out.wav
+e46368ef818f2ec3abcc3f8390d14df5 *./data/out.wav
stddev:3882.46 PSNR:24.54 bytes:1056768
OpenPOWER on IntegriCloud