]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/westwood.c
mpegtsenc: do not reference the deprecated ffmpeg option 'vbsf' in a log message
[ffmpeg] / libavformat / westwood.c
index 5632650b675416f8f6a6369aa56419397a33b006..4cbd5be39671925dcbceec6a814ad58e895199d7 100644 (file)
@@ -320,26 +320,21 @@ static int wsvqa_read_packet(AVFormatContext *s,
     int skip_byte;
 
     while (avio_read(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) {
-        int64_t filesize= avio_size(s->pb);
         chunk_type = AV_RB32(&preamble[0]);
         chunk_size = AV_RB32(&preamble[4]);
 
-        if(chunk_size > filesize){
-            av_log(s, AV_LOG_ERROR, "Chunk with size %d truncated\n", chunk_size);
-            chunk_size= filesize;
-        }
-
         skip_byte = chunk_size & 0x01;
 
+        if ((chunk_type == SND2_TAG || chunk_type == SND1_TAG) && wsvqa->audio_channels == 0) {
+            av_log(s, AV_LOG_ERROR, "audio chunk without any audio header information found\n");
+            return AVERROR_INVALIDDATA;
+        }
+
         if ((chunk_type == SND1_TAG) || (chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG)) {
 
-            if (av_new_packet(pkt, chunk_size))
-                return AVERROR(EIO);
-            ret = avio_read(pb, pkt->data, chunk_size);
-            if (ret != chunk_size) {
-                av_free_packet(pkt);
+            ret= av_get_packet(pb, pkt, chunk_size);
+            if (ret<0)
                 return AVERROR(EIO);
-            }
 
             if (chunk_type == SND2_TAG) {
                 pkt->stream_index = wsvqa->audio_stream_index;