From 999c63e4ca1b0500da73227d0b48591a0e695928 Mon Sep 17 00:00:00 2001 From: Adriano Pallavicino Date: Tue, 17 Jul 2012 09:51:13 +0200 Subject: [PATCH 1/7] rtp: Only choose static payload types if the sample rate and channels are right MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If using a different sample rate or number of channels, use a dynamic payload type instead, where the parameters are passed in the SDP. G722 is a special case where the normal rules don't apply. Signed-off-by: Martin Storsjö --- libavformat/rtp.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libavformat/rtp.c b/libavformat/rtp.c index efc84ab249..b7ebed129f 100644 --- a/libavformat/rtp.c +++ b/libavformat/rtp.c @@ -110,9 +110,17 @@ int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec) !fmt->oformat->priv_class || !av_opt_flag_is_set(fmt->priv_data, "rtpflags", "rfc2190"))) continue; - if (codec->codec_id == CODEC_ID_PCM_S16BE) - if (codec->channels != AVRtpPayloadTypes[i].audio_channels) - continue; + /* G722 has 8000 as nominal rate even if the sample rate is 16000, + * see section 4.5.2 in RFC 3551. */ + if (codec->codec_id == CODEC_ID_ADPCM_G722 && + codec->sample_rate == 16000 && codec->channels == 1) + return AVRtpPayloadTypes[i].pt; + if (codec->codec_type == AVMEDIA_TYPE_AUDIO && + ((AVRtpPayloadTypes[i].clock_rate > 0 && + codec->sample_rate != AVRtpPayloadTypes[i].clock_rate) || + (AVRtpPayloadTypes[i].audio_channels > 0 && + codec->channels != AVRtpPayloadTypes[i].audio_channels))) + continue; return AVRtpPayloadTypes[i].pt; } From 6c1ed454837ccaea0c1d848a9603877f5c1a3c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 23 Jul 2012 16:38:45 +0300 Subject: [PATCH 2/7] configure: Add a dependency on https for rtmpts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rtmpts protocol uses https implicitly, via the ffrtmphttp protocol, but the ffrtmphttp protocol is also useable for plain rtmpt without https, so the dependency needs to be added here instead. Signed-off-by: Martin Storsjö --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index aa5797ab9a..37980f01bc 100755 --- a/configure +++ b/configure @@ -1570,7 +1570,7 @@ rtmps_protocol_deps="!librtmp_protocol" rtmps_protocol_select="tls_protocol" rtmpt_protocol_select="ffrtmphttp_protocol" rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol" -rtmpts_protocol_select="ffrtmphttp_protocol" +rtmpts_protocol_select="ffrtmphttp_protocol https_protocol" rtp_protocol_select="udp_protocol" sctp_protocol_deps="network netinet_sctp_h" tcp_protocol_deps="network" From 816ff352a38ab644c43e2668501d14875912d333 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sun, 22 Jul 2012 15:11:25 +0200 Subject: [PATCH 3/7] doc: Add Git configuration section --- doc/git-howto.texi | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/doc/git-howto.texi b/doc/git-howto.texi index 938e165c1b..51141157c1 100644 --- a/doc/git-howto.texi +++ b/doc/git-howto.texi @@ -258,6 +258,32 @@ git commit @end example +@chapter Git configuration + +In order to simplify a few workflows, it is advisable to configure both +your personal Git installation and your local Libav repository. + +@section Personal Git installation + +Add the following to your @file{~/.gitconfig} to help @command{git send-email} +and @command{git format-patch} detect renames: + +@example +[diff] + renames = copy +@end example + +@section Repository configuration + +In order to have @command{git send-email} automatically send patches +to the libav-devel mailing list, add the following stanza +to @file{/path/to/libav/repository/.git/config}: + +@example +[sendemail] + to = libav-devel@@libav.org +@end example + @chapter Libav specific @section Reverting broken commits From 6b80142144c30579f16735ac9911f1a82e9c990d Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Mon, 23 Jul 2012 23:53:34 +0200 Subject: [PATCH 4/7] build: Skip compiling rtmpdh.h if ffrtmpcrypt protocol is not enabled The ffrtmpcrypt protocol depends on external libraries, which are also required to compile the header file. --- libavformat/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/Makefile b/libavformat/Makefile index 2263b9648d..2eb3e9c8de 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -365,6 +365,7 @@ OBJS-$(CONFIG_TCP_PROTOCOL) += tcp.o OBJS-$(CONFIG_TLS_PROTOCOL) += tls.o OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o +SKIPHEADERS-$(CONFIG_FFRTMPCRYPT_PROTOCOL) += rtmpdh.h SKIPHEADERS-$(CONFIG_NETWORK) += network.h rtsp.h EXAMPLES = metadata \ From 65d94f63ca38b46a9d3719cb7d986d2daef90416 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Tue, 24 Jul 2012 02:14:38 +0200 Subject: [PATCH 5/7] aac: Mention abbreviation as well in long_name Most people know the codec as "AAC" and not "Advanced Audio Coding". --- libavcodec/aacdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 4be525555a..76d4120a41 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -2846,7 +2846,7 @@ AVCodec ff_aac_decoder = { .init = aac_decode_init, .close = aac_decode_close, .decode = aac_decode_frame, - .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"), + .long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"), .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, From f7bfb126cde36e15048273a0e346fe2ebdc27f57 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 24 Jul 2012 13:46:28 +0200 Subject: [PATCH 6/7] rtmp: Move the CONFIG_ condition into the if conditions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes sure these calls are removed by dead code elimination even if optimization is disabled. This fixes building without crypto libraries without optimization. Signed-off-by: Martin Storsjö --- libavformat/rtmpproto.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index f7ba7d5ef8..1d25ae9a60 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -719,7 +719,6 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt) int i; int server_pos, client_pos; uint8_t digest[32], signature[32]; - int encrypted = rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL; int ret, type = 0; av_log(s, AV_LOG_DEBUG, "Handshaking...\n"); @@ -729,7 +728,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt) for (i = 9; i <= RTMP_HANDSHAKE_PACKET_SIZE; i++) tosend[i] = av_lfg_get(&rnd) >> 24; - if (encrypted) { + if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) { /* When the client wants to use RTMPE, we have to change the command * byte to 0x06 which means to use encrypted data and we have to set * the flash version to at least 9.0.115.0. */ @@ -745,7 +744,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt) return ret; } - client_pos = rtmp_handshake_imprint_with_digest(tosend + 1, encrypted); + client_pos = rtmp_handshake_imprint_with_digest(tosend + 1, rt->encrypted); if (client_pos < 0) return client_pos; @@ -799,7 +798,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt) if (ret < 0) return ret; - if (encrypted) { + if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) { /* Compute the shared secret key sent by the server and initialize * the RC4 encryption. */ if ((ret = ff_rtmpe_compute_secret_key(rt->stream, serverdata + 1, @@ -829,7 +828,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt) if (ret < 0) return ret; - if (encrypted) { + if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) { /* Encrypt the signature to be send to the server. */ ff_rtmpe_encrypt_sig(rt->stream, tosend + RTMP_HANDSHAKE_PACKET_SIZE - 32, digest, @@ -841,13 +840,13 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt) RTMP_HANDSHAKE_PACKET_SIZE)) < 0) return ret; - if (encrypted) { + if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) { /* Set RC4 keys for encryption and update the keystreams. */ if ((ret = ff_rtmpe_update_keystream(rt->stream)) < 0) return ret; } } else { - if (encrypted) { + if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) { /* Compute the shared secret key sent by the server and initialize * the RC4 encryption. */ if ((ret = ff_rtmpe_compute_secret_key(rt->stream, serverdata + 1, @@ -865,7 +864,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt) RTMP_HANDSHAKE_PACKET_SIZE)) < 0) return ret; - if (encrypted) { + if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) { /* Set RC4 keys for encryption and update the keystreams. */ if ((ret = ff_rtmpe_update_keystream(rt->stream)) < 0) return ret; From 6a433fdba82ff241be2e9193f66a43689766e4d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 24 Jul 2012 16:01:36 +0300 Subject: [PATCH 7/7] rtmp: Add credit/copyright to librtmp authors for parts of the RTMPE code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Our implementation of RTMPE is heavily based on librtmp. Signed-off-by: Martin Storsjö --- libavformat/rtmpcrypt.c | 2 ++ libavformat/rtmpdh.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libavformat/rtmpcrypt.c b/libavformat/rtmpcrypt.c index 6a4332de86..23125459b5 100644 --- a/libavformat/rtmpcrypt.c +++ b/libavformat/rtmpcrypt.c @@ -1,5 +1,7 @@ /* * RTMPE network protocol + * Copyright (c) 2008-2009 Andrej Stepanchuk + * Copyright (c) 2009-2010 Howard Chu * Copyright (c) 2012 Samuel Pitoiset * * This file is part of Libav. diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c index 8ddc5fcee8..92bce7a0bc 100644 --- a/libavformat/rtmpdh.c +++ b/libavformat/rtmpdh.c @@ -1,5 +1,7 @@ /* * RTMP Diffie-Hellmann utilities + * Copyright (c) 2009 Andrej Stepanchuk + * Copyright (c) 2009-2010 Howard Chu * Copyright (c) 2012 Samuel Pitoiset * * This file is part of Libav.