[FFmpeg-devel] [PATCH] Only check for invalid codec_id if the codec tag was supposed to be in the current packet.

Justin Ruggles justin.ruggles
Tue Jan 18 18:19:31 CET 2011


On 01/18/2011 12:14 PM, Justin Ruggles wrote:

> On 01/18/2011 10:21 AM, Michael Niedermayer wrote:
> 
>> On Tue, Jan 18, 2011 at 04:16:34PM +0100, Michael Niedermayer wrote:
>>> On Tue, Jan 18, 2011 at 08:55:33AM -0500, Justin Ruggles wrote:
>>>>
>>>> Fixes decoding of stereo VOC files.
>>>> ---
>>>>  libavformat/vocdec.c |    3 ++-
>>>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>>>
>>>
>>>>  vocdec.c |    3 ++-
>>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>> 1e38294ad07cc0f39e1941852b13ad42997debe5  0001-Only-check-for-invalid-codec_id-if-the-codec-tag-was.patch
>>>> diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c
>>>> index 7cc37f0..1a77a4b 100644
>>>> --- a/libavformat/vocdec.c
>>>> +++ b/libavformat/vocdec.c
>>>> @@ -133,7 +133,8 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
>>>>              voc->remaining_size = 0;
>>>>              break;
>>>>          }
>>>> -        if (dec->codec_id == CODEC_ID_NONE) {
>>>> +        if ((type == VOC_TYPE_VOICE_DATA || type == VOC_TYPE_NEW_VOICE_DATA) &&
>>>> +            dec->codec_id == CODEC_ID_NONE) {
>>>>              av_log(s, AV_LOG_ERROR, "Invalid codec_id\n");
>>>
>>> this check still looks wrong to me
>>> (example is if there is no such packet at all)
>>
>> to clarify, the patch is ok as such it improves things but it doesnt fully
>> fix this check
> 
> 
> new patch.


--- a/libavformat/vocenc.c
+++ b/libavformat/vocenc.c
@@ -52,7 +52,7 @@ static int voc_write_packet(AVFormatContext *s,
AVPacket *pkt)
     ByteIOContext *pb = s->pb;

     if (!voc->param_written) {
-        if (enc->codec_tag > 0xFF) {
+        if (enc->codec_tag > 0x3) {
             put_byte(pb, VOC_TYPE_NEW_VOICE_DATA);
             put_le24(pb, pkt->size + 12);
             put_le32(pb, enc->sample_rate);


oops ignore that part.



More information about the ffmpeg-devel mailing list