Corrected the patch a bit, now setting extradata_size to 0

On Mon, Feb 29, 2016 at 1:13 PM, Andrew Shulgin <andrewshulgi...@gmail.com>
wrote:

> Correct SPS and PPS are in the stream.
> Maybe it's reasonale to use existing SPS. But i'm not sure how to
> implement that.
> Yeah really, setting extradata_size to 0 should not be skipped.
>
> On Mon, Feb 29, 2016 at 1:01 PM, Michael Niedermayer <
> mich...@niedermayer.cc> wrote:
>
>> On Sat, Feb 27, 2016 at 09:56:01PM +0200, Andrew Shulgin wrote:
>> > Some Hikvison RTSP cameras send wrong sprop-parameter-sets in SDP - it's
>> > missing PPS.
>> >
>> > Example of correct sprop-parameter-sets:
>> > sprop-parameter-sets=Z0IAH5W4PASaEAAAcIAAFfkAQA==,aM48gA==
>> > Example of wrong sprop-parameter-sets:
>> > sprop-parameter-sets=Z0IAH5WoPASaEAAAcIAAFfkIQA==,
>> >
>> > My patch adds a workaround that ignores invalid sprop-parameter-sets.
>>
>> from where does it get the correct parameter set ?
>> is it in the stream ? or repeated sprop-parameter-sets ?
>>
>> also shuldnt the sps be used instead of skipped?
>> or the skip code be made conditional on codec->extradata_size > 0 ?
>>
>> [...]
>> --
>> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> Complexity theory is the science of finding the exact solution to an
>> approximation. Benchmarking OTOH is finding an approximation of the exact
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>>
>
From 5ba47e182a47753ed47344b25fd6ba9d15698fd1 Mon Sep 17 00:00:00 2001
From: Andrew Shulgin <andrewshulgi...@gmail.com>
Date: Mon, 29 Feb 2016 13:57:42 +0200
Subject: [PATCH] Ignore invalid sprop-parameter-sets missing PPS

---
 libavformat/rtpdec_h264.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
index b399be4..4c0003e 100644
--- a/libavformat/rtpdec_h264.c
+++ b/libavformat/rtpdec_h264.c
@@ -168,6 +168,10 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
         int ret;
         codec->extradata_size = 0;
         av_freep(&codec->extradata);
+        if (value[strlen(value) - 1] == ',') {
+            av_log(s, AV_LOG_WARNING, "Missing PPS in sprop-parameter-sets, ignoring\n");
+            return 0;
+        }
         ret = ff_h264_parse_sprop_parameter_sets(s, &codec->extradata,
                                                  &codec->extradata_size, value);
         av_log(s, AV_LOG_DEBUG, "Extradata set to %p (size: %d)\n",
-- 
2.4.10

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to