AVCodec *c;
const char *c_name;
- /* Loop into AVRtpDynamicPayloadTypes[] and AVRtpPayloadTypes[] and
- * see if we can handle this kind of payload.
+ /* See if we can handle this kind of payload.
* The space should normally not be there but some Real streams or
* particular servers ("RealServer Version 6.1.3.970", see issue 1658)
* have a trailing space. */
if (payload_type < RTP_PT_PRIVATE) {
/* We are in a standard case
* (from http://www.iana.org/assignments/rtp-parameters). */
- /* search into AVRtpPayloadTypes[] */
codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type);
}
i = atoi(buf);
if (i > 0)
codec->channels = i;
- // TODO: there is a bug here; if it is a mono stream, and
- // less than 22000Hz, faad upconverts to stereo and twice
- // the frequency. No problem, but the sample rate is being
- // set here by the sdp line. Patch on its way. (rdm)
}
av_log(s, AV_LOG_DEBUG, "audio samplerate set to: %i\n",
codec->sample_rate);
get_word(buf1, sizeof(buf1), &p); /* protocol */
if (!strcmp(buf1, "udp"))
rt->transport = RTSP_TRANSPORT_RAW;
+ else if (strstr(buf1, "/AVPF") || strstr(buf1, "/SAVPF"))
+ rtsp_st->feedback = 1;
/* XXX: handle list of formats */
get_word(buf1, sizeof(buf1), &p); /* format list */
rt->cur_transport_priv = NULL;
}
+redo:
if (rt->transport == RTSP_TRANSPORT_RTP) {
int i;
int64_t first_queue_time = 0;
first_queue_st = rt->rtsp_streams[i];
}
}
- if (first_queue_time)
+ if (first_queue_time) {
wait_end = first_queue_time + s->max_delay;
+ } else {
+ wait_end = 0;
+ first_queue_st = NULL;
+ }
}
/* read next RTP packet */
- redo:
if (!rt->recvbuf) {
rt->recvbuf = av_malloc(RECVBUF_SIZE);
if (!rt->recvbuf)
ff_rtp_check_and_send_back_rr(rtsp_st->transport_priv, rtsp_st->rtp_handle, NULL, len);
break;
case RTSP_LOWER_TRANSPORT_CUSTOM:
- len = ffio_read_partial(s->pb, rt->recvbuf, RECVBUF_SIZE);
+ if (first_queue_st && rt->transport == RTSP_TRANSPORT_RTP &&
+ wait_end && wait_end < av_gettime())
+ len = AVERROR(EAGAIN);
+ else
+ len = ffio_read_partial(s->pb, rt->recvbuf, RECVBUF_SIZE);
len = pick_stream(s, &rtsp_st, rt->recvbuf, len);
if (len > 0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP)
ff_rtp_check_and_send_back_rr(rtsp_st->transport_priv, NULL, s->pb, len);
ret = ff_rdt_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len);
} else if (rt->transport == RTSP_TRANSPORT_RTP) {
ret = ff_rtp_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len);
+ if (rtsp_st->feedback) {
+ AVIOContext *pb = NULL;
+ if (rt->lower_transport == RTSP_LOWER_TRANSPORT_CUSTOM)
+ pb = s->pb;
+ ff_rtp_send_rtcp_feedback(rtsp_st->transport_priv, rtsp_st->rtp_handle, pb);
+ }
if (ret < 0) {
/* Either bad packet, or a RTCP packet. Check if the
* first_rtcp_ntp_time field was initialized. */