comparison rtpenc.c @ 5646:7826bf683210 libavformat

Fix syncronisation for streams with a high encoding delay. Patch by Timo Ter¸«£s (timo DOT teras AT iki DOT fi)
author lucabe
date Wed, 10 Feb 2010 19:33:08 +0000
parents f9d233143854
children f4ca0041b4f4
comparison
equal deleted inserted replaced
5645:ebf397240c91 5646:7826bf683210
89 s->base_timestamp = 0; /* FIXME: was random(), what should this be? */ 89 s->base_timestamp = 0; /* FIXME: was random(), what should this be? */
90 s->timestamp = s->base_timestamp; 90 s->timestamp = s->base_timestamp;
91 s->cur_timestamp = 0; 91 s->cur_timestamp = 0;
92 s->ssrc = 0; /* FIXME: was random(), what should this be? */ 92 s->ssrc = 0; /* FIXME: was random(), what should this be? */
93 s->first_packet = 1; 93 s->first_packet = 1;
94 s->first_rtcp_ntp_time = AV_NOPTS_VALUE; 94 s->first_rtcp_ntp_time = ntp_time();
95 95
96 max_packet_size = url_fget_max_packet_size(s1->pb); 96 max_packet_size = url_fget_max_packet_size(s1->pb);
97 if (max_packet_size <= 12) 97 if (max_packet_size <= 12)
98 return AVERROR(EIO); 98 return AVERROR(EIO);
99 s->buf = av_malloc(max_packet_size); 99 s->buf = av_malloc(max_packet_size);
169 RTPMuxContext *s = s1->priv_data; 169 RTPMuxContext *s = s1->priv_data;
170 uint32_t rtp_ts; 170 uint32_t rtp_ts;
171 171
172 dprintf(s1, "RTCP: %02x %"PRIx64" %x\n", s->payload_type, ntp_time, s->timestamp); 172 dprintf(s1, "RTCP: %02x %"PRIx64" %x\n", s->payload_type, ntp_time, s->timestamp);
173 173
174 if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE) s->first_rtcp_ntp_time = ntp_time;
175 s->last_rtcp_ntp_time = ntp_time; 174 s->last_rtcp_ntp_time = ntp_time;
176 rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 1000000}, 175 rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 1000000},
177 s1->streams[0]->time_base) + s->base_timestamp; 176 s1->streams[0]->time_base) + s->base_timestamp;
178 put_byte(s1->pb, (RTP_VERSION << 6)); 177 put_byte(s1->pb, (RTP_VERSION << 6));
179 put_byte(s1->pb, 200); 178 put_byte(s1->pb, 200);