de002b93db
To avoid Guile module dependency cycles, inherited packages must be defined in the same module. Use this opportunity to simplify the patches applying mechanism, versioning custom patches the same as for other packages. * gnu/packages/patches/ffmpeg-jami-change-RTCP-ratio.patch: New file. * gnu/packages/patches/ffmpeg-jami-rtp_ext_abs_send_time.patch: Likewise. * gnu/packages/patches/ffmpeg-jami-libopusdec-enable-FEC.patch: Likewise. * gnu/packages/patches/ffmpeg-jami-libopusenc-enable-FEC.patch: Likewise. * gnu/packages/patches/ffmpeg-jami-libopusenc-reload-packet-loss-at-encode.patch: Likewise. * gnu/packages/patches/ffmpeg-jami-remove-mjpeg-log.patch: Likewise. * gnu/packages/patches/ffmpeg-jami-screen-sharing-x11-fix.patch: Likewise. * gnu/local.mk (dist_patch_DATA): Register them. * gnu/packages/jami.scm (jami-apply-custom-patches): Delete procedure. (%ffmpeg-default-configure-flags): Delete variable. (ffmpeg-compose-configure-flags): Delete procedure. (ffmpeg-jami): Move to... * gnu/packages/video.scm (ffmpeg-jami): ... here. Apply patches to origin and repatriate configure flags. Change-Id: Id374fae18240cd76b224915d80b61422635ccb77
71 lines
2.6 KiB
Diff
71 lines
2.6 KiB
Diff
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
|
|
index 63047beccc..d59ec3dc8c 100644
|
|
--- a/libavformat/rtpenc.c
|
|
+++ b/libavformat/rtpenc.c
|
|
@@ -28,6 +28,8 @@
|
|
|
|
#include "rtpenc.h"
|
|
|
|
+#define EXT_ABS_SEND_TIME
|
|
+
|
|
static const AVOption options[] = {
|
|
FF_RTP_FLAG_OPTS(RTPMuxContext, flags),
|
|
{ "payload_type", "Specify RTP payload type", offsetof(RTPMuxContext, payload_type), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, 127, AV_OPT_FLAG_ENCODING_PARAM },
|
|
@@ -146,7 +148,11 @@ static int rtp_write_header(AVFormatContext *s1)
|
|
s1->pb->max_packet_size);
|
|
} else
|
|
s1->packet_size = s1->pb->max_packet_size;
|
|
+#ifdef EXT_ABS_SEND_TIME
|
|
+ if (s1->packet_size <= 20) {
|
|
+#else
|
|
if (s1->packet_size <= 12) {
|
|
+#endif
|
|
av_log(s1, AV_LOG_ERROR, "Max packet size %u too low\n", s1->packet_size);
|
|
return AVERROR(EIO);
|
|
}
|
|
@@ -154,7 +160,11 @@ static int rtp_write_header(AVFormatContext *s1)
|
|
if (!s->buf) {
|
|
return AVERROR(ENOMEM);
|
|
}
|
|
+#ifdef EXT_ABS_SEND_TIME
|
|
+ s->max_payload_size = s1->packet_size - 20;
|
|
+#else
|
|
s->max_payload_size = s1->packet_size - 12;
|
|
+#endif
|
|
|
|
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
|
avpriv_set_pts_info(st, 32, 1, st->codecpar->sample_rate);
|
|
@@ -332,16 +342,34 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time, int bye)
|
|
void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m)
|
|
{
|
|
RTPMuxContext *s = s1->priv_data;
|
|
+ uint64_t ntp64_time;
|
|
+ uint32_t absoluteSendTime;
|
|
|
|
av_log(s1, AV_LOG_TRACE, "rtp_send_data size=%d\n", len);
|
|
|
|
/* build the RTP header */
|
|
+#ifdef EXT_ABS_SEND_TIME
|
|
+ avio_w8(s1->pb, RTP_VERSION << 6 | 0x10); // extention bit
|
|
+#else
|
|
avio_w8(s1->pb, RTP_VERSION << 6);
|
|
+#endif
|
|
avio_w8(s1->pb, (s->payload_type & 0x7f) | ((m & 0x01) << 7));
|
|
avio_wb16(s1->pb, s->seq);
|
|
avio_wb32(s1->pb, s->timestamp);
|
|
avio_wb32(s1->pb, s->ssrc);
|
|
|
|
+#ifdef EXT_ABS_SEND_TIME
|
|
+ avio_wb16(s1->pb, 0xBEDE); // magic word
|
|
+ avio_wb16(s1->pb, 0x0001); // length=1
|
|
+ avio_w8(s1->pb, 0x32); // ID=3 and lenght=2
|
|
+ ntp64_time = ff_get_formatted_ntp_time(ff_ntp_time());
|
|
+ absoluteSendTime = (uint32_t)((ntp64_time>> 14) & 0x00ffffff);
|
|
+ av_log(s1, AV_LOG_TRACE, "ntp64:%lu, abs_time:%u\n", ntp64_time, absoluteSendTime);
|
|
+ avio_w8(s1->pb, (uint8_t)(absoluteSendTime >> 16));
|
|
+ avio_w8(s1->pb, (uint8_t)(absoluteSendTime >> 8 & 0xff));
|
|
+ avio_w8(s1->pb, (uint8_t)(absoluteSendTime & 0xff));
|
|
+#endif
|
|
+
|
|
avio_write(s1->pb, buf1, len);
|
|
avio_flush(s1->pb);
|