On Wed, 17 Dec 2014, Martin Storsjö wrote:

From: Thomas Volkert <[email protected]>

The packetizer only supports splitting at GOB headers - if
such aren't available frequently enough, it splits at any
random byte offset (not at a macroblock boundary either, which
would be allowed by the spec) and sends a payload header pretend
that it starts with a GOB header.

As long as a receiver doesn't try to handle such cases cleverly
but just drops broken frames, this shouldn't matter too much
in practice.
---
Changelog                    |   1 +
libavformat/Makefile         |   2 +
libavformat/rtpdec.c         |   1 +
libavformat/rtpdec_formats.h |   1 +
libavformat/rtpdec_h261.c    | 202 +++++++++++++++++++++++++++++++++++++++++++
libavformat/rtpenc.c         |   4 +
libavformat/rtpenc.h         |   1 +
libavformat/rtpenc_h261.c    | 102 ++++++++++++++++++++++
libavformat/sdp.c            |  13 +++
libavformat/version.h        |   4 +-
10 files changed, 329 insertions(+), 2 deletions(-)
create mode 100644 libavformat/rtpdec_h261.c
create mode 100644 libavformat/rtpenc_h261.c


diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index a14a239..c033267 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -498,6 +498,19 @@ static char *sdp_write_media_attributes(char *buff, int 
size, AVCodecContext *c,
                                     payload_type, mode, config ? config : "");
            break;
        }
+        case AV_CODEC_ID_H261:
+        {
+            const char *pic_fmt = NULL;
+            /* only QCIF and CIF are specified as supported in RFC 4587 */
+            if (c->width == 176 && c->height == 144)
+                pic_fmt = "QCIF=1";
+            else if (c->width == 352 && c->height == 288)
+                pic_fmt = "CIF=1";
+            av_strlcatf(buff, size, "a=rtpmap:%d H261/90000\r\n", 
payload_type);
+            if (pic_fmt)
+                av_strlcatf(buff, size, "a=fmtp:%d %s\r\n", payload_type, 
pic_fmt);
+            break;
+        }

Actually, I'd add an "if (payload_type >= RTP_PT_PRIVATE)" before the rtpmap line - normally we don't print rtpmap lines for formats with a statically allcated payload type.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to