| Index: patched-ffmpeg-mt/libavformat/rtpdec.c
|
| ===================================================================
|
| --- patched-ffmpeg-mt/libavformat/rtpdec.c (revision 41250)
|
| +++ patched-ffmpeg-mt/libavformat/rtpdec.c (working copy)
|
| @@ -30,10 +30,11 @@
|
| #include "network.h"
|
|
|
| #include "rtpdec.h"
|
| -#include "rtp_asf.h"
|
| -#include "rtp_h264.h"
|
| -#include "rtp_vorbis.h"
|
| +#include "rtpdec_amr.h"
|
| +#include "rtpdec_asf.h"
|
| #include "rtpdec_h263.h"
|
| +#include "rtpdec_h264.h"
|
| +#include "rtpdec_vorbis.h"
|
|
|
| //#define DEBUG
|
|
|
| @@ -62,6 +63,8 @@
|
| {
|
| ff_register_dynamic_payload_handler(&mp4v_es_handler);
|
| ff_register_dynamic_payload_handler(&mpeg4_generic_handler);
|
| + ff_register_dynamic_payload_handler(&ff_amr_nb_dynamic_handler);
|
| + ff_register_dynamic_payload_handler(&ff_amr_wb_dynamic_handler);
|
| ff_register_dynamic_payload_handler(&ff_h263_1998_dynamic_handler);
|
| ff_register_dynamic_payload_handler(&ff_h263_2000_dynamic_handler);
|
| ff_register_dynamic_payload_handler(&ff_h264_dynamic_handler);
|
| @@ -76,8 +79,6 @@
|
| if (buf[1] != 200)
|
| return -1;
|
| s->last_rtcp_ntp_time = AV_RB64(buf + 8);
|
| - if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE)
|
| - s->first_rtcp_ntp_time = s->last_rtcp_ntp_time;
|
| s->last_rtcp_timestamp = AV_RB32(buf + 16);
|
| return 0;
|
| }
|
| @@ -270,6 +271,45 @@
|
| return 0;
|
| }
|
|
|
| +void rtp_send_punch_packets(URLContext* rtp_handle)
|
| +{
|
| + ByteIOContext *pb;
|
| + uint8_t *buf;
|
| + int len;
|
| +
|
| + /* Send a small RTP packet */
|
| + if (url_open_dyn_buf(&pb) < 0)
|
| + return;
|
| +
|
| + put_byte(pb, (RTP_VERSION << 6));
|
| + put_byte(pb, 0); /* Payload type */
|
| + put_be16(pb, 0); /* Seq */
|
| + put_be32(pb, 0); /* Timestamp */
|
| + put_be32(pb, 0); /* SSRC */
|
| +
|
| + put_flush_packet(pb);
|
| + len = url_close_dyn_buf(pb, &buf);
|
| + if ((len > 0) && buf)
|
| + url_write(rtp_handle, buf, len);
|
| + av_free(buf);
|
| +
|
| + /* Send a minimal RTCP RR */
|
| + if (url_open_dyn_buf(&pb) < 0)
|
| + return;
|
| +
|
| + put_byte(pb, (RTP_VERSION << 6));
|
| + put_byte(pb, 201); /* receiver report */
|
| + put_be16(pb, 1); /* length in words - 1 */
|
| + put_be32(pb, 0); /* our own SSRC */
|
| +
|
| + put_flush_packet(pb);
|
| + len = url_close_dyn_buf(pb, &buf);
|
| + if ((len > 0) && buf)
|
| + url_write(rtp_handle, buf, len);
|
| + av_free(buf);
|
| +}
|
| +
|
| +
|
| /**
|
| * open a new RTP parse context for stream 'st'. 'st' can be NULL for
|
| * MPEG2TS streams to indicate that they should be demuxed inside the
|
| @@ -285,7 +325,6 @@
|
| return NULL;
|
| s->payload_type = payload_type;
|
| s->last_rtcp_ntp_time = AV_NOPTS_VALUE;
|
| - s->first_rtcp_ntp_time = AV_NOPTS_VALUE;
|
| s->ic = s1;
|
| s->st = st;
|
| s->rtp_payload_data = rtp_payload_data;
|
| @@ -389,7 +428,7 @@
|
| /* compute pts from timestamp with received ntp_time */
|
| delta_timestamp = timestamp - s->last_rtcp_timestamp;
|
| /* convert to the PTS timebase */
|
| - addend = av_rescale(s->last_rtcp_ntp_time - s->first_rtcp_ntp_time, s->st->time_base.den, (uint64_t)s->st->time_base.num << 32);
|
| + addend = av_rescale(s->last_rtcp_ntp_time, s->st->time_base.den, (uint64_t)s->st->time_base.num << 32);
|
| pkt->pts = addend + delta_timestamp;
|
| }
|
| }
|
|
|