Unified · Split
| @@ -3169,8 +3169,8 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url, · 3168 unmodified lines | |||
| 3169 | 3169 | ||
| 3170 | switch(rtp_c->rtp_protocol) { | 3170 | switch(rtp_c->rtp_protocol) { |
| 3171 | case RTSP_LOWER_TRANSPORT_UDP: | 3171 | case RTSP_LOWER_TRANSPORT_UDP: |
| 3172 | rtp_port = rtp_get_local_rtp_port(rtp_c->rtp_handles[stream_index]); | 3172 | rtp_port = ff_rtp_get_local_rtp_port(rtp_c->rtp_handles[stream_index]); |
| 3173 | rtcp_port = rtp_get_local_rtcp_port(rtp_c->rtp_handles[stream_index]); | 3173 | rtcp_port = ff_rtp_get_local_rtcp_port(rtp_c->rtp_handles[stream_index]); |
| 3174 | avio_printf(c->pb, "Transport: RTP/AVP/UDP;unicast;" | 3174 | avio_printf(c->pb, "Transport: RTP/AVP/UDP;unicast;" |
| 3175 | "client_port=%d-%d;server_port=%d-%d", | 3175 | "client_port=%d-%d;server_port=%d-%d", |
| 3176 | th->client_port_min, th->client_port_max, | 3176 | th->client_port_min, th->client_port_max, |
| @@ -218,7 +218,7 @@ static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq) · 217 unmodified lines | |||
| 218 | return 1; | 218 | return 1; |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) | 221 | int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) |
| 222 | { | 222 | { |
| 223 | AVIOContext *pb; | 223 | AVIOContext *pb; |
| 224 | uint8_t *buf; | 224 | uint8_t *buf; |
| @@ -315,7 +315,7 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) · 90 unmodified lines | |||
| 315 | return 0; | 315 | return 0; |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | void rtp_send_punch_packets(URLContext* rtp_handle) | 318 | void ff_rtp_send_punch_packets(URLContext* rtp_handle) |
| 319 | { | 319 | { |
| 320 | AVIOContext *pb; | 320 | AVIOContext *pb; |
| 321 | uint8_t *buf; | 321 | uint8_t *buf; |
| @@ -359,7 +359,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle) · 37 unmodified lines | |||
| 359 | * MPEG2TS streams to indicate that they should be demuxed inside the | 359 | * MPEG2TS streams to indicate that they should be demuxed inside the |
| 360 | * rtp demux (otherwise CODEC_ID_MPEG2TS packets are returned) | 360 | * rtp demux (otherwise CODEC_ID_MPEG2TS packets are returned) |
| 361 | */ | 361 | */ |
| 362 | RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size) | 362 | RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size) |
| 363 | { | 363 | { |
| 364 | RTPDemuxContext *s; | 364 | RTPDemuxContext *s; |
| 365 | 365 | ||
| @@ -407,8 +407,8 @@ RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *r · 41 unmodified lines | |||
| 407 | } | 407 | } |
| 408 | 408 | ||
| 409 | void | 409 | void |
| 410 | rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, | 410 | ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, |
| 411 | RTPDynamicProtocolHandler *handler) | 411 | RTPDynamicProtocolHandler *handler) |
| 412 | { | 412 | { |
| 413 | s->dynamic_protocol_context = ctx; | 413 | s->dynamic_protocol_context = ctx; |
| 414 | s->parse_packet = handler->parse_packet; | 414 | s->parse_packet = handler->parse_packet; |
| @@ -722,8 +722,8 @@ static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt, · 307 unmodified lines | |||
| 722 | * @return 0 if a packet is returned, 1 if a packet is returned and more can follow | 722 | * @return 0 if a packet is returned, 1 if a packet is returned and more can follow |
| 723 | * (use buf as NULL to read the next). -1 if no packet (error or no more packet). | 723 | * (use buf as NULL to read the next). -1 if no packet (error or no more packet). |
| 724 | */ | 724 | */ |
| 725 | int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, | 725 | int ff_rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, |
| 726 | uint8_t **bufptr, int len) | 726 | uint8_t **bufptr, int len) |
| 727 | { | 727 | { |
| 728 | int rv = rtp_parse_one_packet(s, pkt, bufptr, len); | 728 | int rv = rtp_parse_one_packet(s, pkt, bufptr, len); |
| 729 | s->prev_ret = rv; | 729 | s->prev_ret = rv; |
| @@ -732,7 +732,7 @@ int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, · 2 unmodified lines | |||
| 732 | return rv ? rv : has_next_packet(s); | 732 | return rv ? rv : has_next_packet(s); |
| 733 | } | 733 | } |
| 734 | 734 | ||
| 735 | void rtp_parse_close(RTPDemuxContext *s) | 735 | void ff_rtp_parse_close(RTPDemuxContext *s) |
| 736 | { | 736 | { |
| 737 | ff_rtp_reset_packet_queue(s); | 737 | ff_rtp_reset_packet_queue(s); |
| 738 | if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) { | 738 | if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) { |
| @@ -38,18 +38,18 @@ typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler; · 37 unmodified lines | |||
| 38 | #define RTP_NOTS_VALUE ((uint32_t)-1) | 38 | #define RTP_NOTS_VALUE ((uint32_t)-1) |
| 39 | 39 | ||
| 40 | typedef struct RTPDemuxContext RTPDemuxContext; | 40 | typedef struct RTPDemuxContext RTPDemuxContext; |
| 41 | RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size); | 41 | RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size); |
| 42 | void rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, | 42 | void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, |
| 43 | RTPDynamicProtocolHandler *handler); | 43 | RTPDynamicProtocolHandler *handler); |
| 44 | int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, | 44 | int ff_rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, |
| 45 | uint8_t **buf, int len); | 45 | uint8_t **buf, int len); |
| 46 | void rtp_parse_close(RTPDemuxContext *s); | 46 | void ff_rtp_parse_close(RTPDemuxContext *s); |
| 47 | int64_t ff_rtp_queued_packet_time(RTPDemuxContext *s); | 47 | int64_t ff_rtp_queued_packet_time(RTPDemuxContext *s); |
| 48 | void ff_rtp_reset_packet_queue(RTPDemuxContext *s); | 48 | void ff_rtp_reset_packet_queue(RTPDemuxContext *s); |
| 49 | int rtp_get_local_rtp_port(URLContext *h); | 49 | int ff_rtp_get_local_rtp_port(URLContext *h); |
| 50 | int rtp_get_local_rtcp_port(URLContext *h); | 50 | int ff_rtp_get_local_rtcp_port(URLContext *h); |
| 51 | 51 | ||
| 52 | int rtp_set_remote_url(URLContext *h, const char *uri); | 52 | int ff_rtp_set_remote_url(URLContext *h, const char *uri); |
| 53 | 53 | ||
| 54 | /** | 54 | /** |
| 55 | * Send a dummy packet on both port pairs to set up the connection | 55 | * Send a dummy packet on both port pairs to set up the connection |
| @@ -62,19 +62,19 @@ int rtp_set_remote_url(URLContext *h, const char *uri); · 6 unmodified lines | |||
| 62 | * The same routine is used with RDT too, even if RDT doesn't use normal | 62 | * The same routine is used with RDT too, even if RDT doesn't use normal |
| 63 | * RTP packets otherwise. | 63 | * RTP packets otherwise. |
| 64 | */ | 64 | */ |
| 65 | void rtp_send_punch_packets(URLContext* rtp_handle); | 65 | void ff_rtp_send_punch_packets(URLContext* rtp_handle); |
| 66 | 66 | ||
| 67 | /** | 67 | /** |
| 68 | * some rtp servers assume client is dead if they don't hear from them... | 68 | * some rtp servers assume client is dead if they don't hear from them... |
| 69 | * so we send a Receiver Report to the provided ByteIO context | 69 | * so we send a Receiver Report to the provided ByteIO context |
| 70 | * (we don't have access to the rtcp handle from here) | 70 | * (we don't have access to the rtcp handle from here) |
| 71 | */ | 71 | */ |
| 72 | int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count); | 72 | int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count); |
| 73 | 73 | ||
| 74 | /** | 74 | /** |
| 75 | * Get the file handle for the RTCP socket. | 75 | * Get the file handle for the RTCP socket. |
| 76 | */ | 76 | */ |
| 77 | int rtp_get_rtcp_file_handle(URLContext *h); | 77 | int ff_rtp_get_rtcp_file_handle(URLContext *h); |
| 78 | 78 | ||
| 79 | // these statistics are used for rtcp receiver reports... | 79 | // these statistics are used for rtcp receiver reports... |
| 80 | typedef struct { | 80 | typedef struct { |
| @@ -60,7 +60,7 @@ typedef struct RTPContext { · 59 unmodified lines | |||
| 60 | * @return zero if no error. | 60 | * @return zero if no error. |
| 61 | */ | 61 | */ |
| 62 | 62 | ||
| 63 | int rtp_set_remote_url(URLContext *h, const char *uri) | 63 | int ff_rtp_set_remote_url(URLContext *h, const char *uri) |
| 64 | { | 64 | { |
| 65 | RTPContext *s = h->priv_data; | 65 | RTPContext *s = h->priv_data; |
| 66 | char hostname[256]; | 66 | char hostname[256]; |
| @@ -300,7 +300,7 @@ static int rtp_close(URLContext *h) · 233 unmodified lines | |||
| 300 | * @return the local port number | 300 | * @return the local port number |
| 301 | */ | 301 | */ |
| 302 | 302 | ||
| 303 | int rtp_get_local_rtp_port(URLContext *h) | 303 | int ff_rtp_get_local_rtp_port(URLContext *h) |
| 304 | { | 304 | { |
| 305 | RTPContext *s = h->priv_data; | 305 | RTPContext *s = h->priv_data; |
| 306 | return ff_udp_get_local_port(s->rtp_hd); | 306 | return ff_udp_get_local_port(s->rtp_hd); |
| @@ -312,7 +312,7 @@ int rtp_get_local_rtp_port(URLContext *h) · 5 unmodified lines | |||
| 312 | * @return the local port number | 312 | * @return the local port number |
| 313 | */ | 313 | */ |
| 314 | 314 | ||
| 315 | int rtp_get_local_rtcp_port(URLContext *h) | 315 | int ff_rtp_get_local_rtcp_port(URLContext *h) |
| 316 | { | 316 | { |
| 317 | RTPContext *s = h->priv_data; | 317 | RTPContext *s = h->priv_data; |
| 318 | return ff_udp_get_local_port(s->rtcp_hd); | 318 | return ff_udp_get_local_port(s->rtcp_hd); |
| @@ -324,7 +324,7 @@ static int rtp_get_file_handle(URLContext *h) · 5 unmodified lines | |||
| 324 | return s->rtp_fd; | 324 | return s->rtp_fd; |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | int rtp_get_rtcp_file_handle(URLContext *h) { | 327 | int ff_rtp_get_rtcp_file_handle(URLContext *h) { |
| 328 | RTPContext *s = h->priv_data; | 328 | RTPContext *s = h->priv_data; |
| 329 | return s->rtcp_fd; | 329 | return s->rtcp_fd; |
| 330 | } | 330 | } |
| @@ -501,7 +501,7 @@ void ff_rtsp_undo_setup(AVFormatContext *s) · 500 unmodified lines | |||
| 501 | } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) | 501 | } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) |
| 502 | ff_rdt_parse_close(rtsp_st->transport_priv); | 502 | ff_rdt_parse_close(rtsp_st->transport_priv); |
| 503 | else if (CONFIG_RTPDEC) | 503 | else if (CONFIG_RTPDEC) |
| 504 | rtp_parse_close(rtsp_st->transport_priv); | 504 | ff_rtp_parse_close(rtsp_st->transport_priv); |
| 505 | } | 505 | } |
| 506 | rtsp_st->transport_priv = NULL; | 506 | rtsp_st->transport_priv = NULL; |
| 507 | if (rtsp_st->rtp_handle) | 507 | if (rtsp_st->rtp_handle) |
| @@ -558,7 +558,7 @@ static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) · 50 unmodified lines | |||
| 558 | rtsp_st->dynamic_protocol_context, | 558 | rtsp_st->dynamic_protocol_context, |
| 559 | rtsp_st->dynamic_handler); | 559 | rtsp_st->dynamic_handler); |
| 560 | else if (CONFIG_RTPDEC) | 560 | else if (CONFIG_RTPDEC) |
| 561 | rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle, | 561 | rtsp_st->transport_priv = ff_rtp_parse_open(s, st, rtsp_st->rtp_handle, |
| 562 | rtsp_st->sdp_payload_type, | 562 | rtsp_st->sdp_payload_type, |
| 563 | (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay) | 563 | (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay) |
| 564 | ? 0 : RTP_REORDER_QUEUE_DEFAULT_SIZE); | 564 | ? 0 : RTP_REORDER_QUEUE_DEFAULT_SIZE); |
| @@ -567,9 +567,9 @@ static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) · 2 unmodified lines | |||
| 567 | return AVERROR(ENOMEM); | 567 | return AVERROR(ENOMEM); |
| 568 | } else if (rt->transport != RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) { | 568 | } else if (rt->transport != RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) { |
| 569 | if (rtsp_st->dynamic_handler) { | 569 | if (rtsp_st->dynamic_handler) { |
| 570 | rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv, | 570 | ff_rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv, |
| 571 | rtsp_st->dynamic_protocol_context, | 571 | rtsp_st->dynamic_protocol_context, |
| 572 | rtsp_st->dynamic_handler); | 572 | rtsp_st->dynamic_handler); |
| 573 | } | 573 | } |
| 574 | } | 574 | } |
| 575 | 575 | ||
| @@ -1121,7 +1121,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, · 545 unmodified lines | |||
| 1121 | goto fail; | 1121 | goto fail; |
| 1122 | 1122 | ||
| 1123 | rtp_opened: | 1123 | rtp_opened: |
| 1124 | port = rtp_get_local_rtp_port(rtsp_st->rtp_handle); | 1124 | port = ff_rtp_get_local_rtp_port(rtsp_st->rtp_handle); |
| 1125 | have_port: | 1125 | have_port: |
| 1126 | snprintf(transport, sizeof(transport) - 1, | 1126 | snprintf(transport, sizeof(transport) - 1, |
| 1127 | "%s/UDP;", trans_pref); | 1127 | "%s/UDP;", trans_pref); |
| @@ -1225,7 +1225,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, · 97 unmodified lines | |||
| 1225 | reply->transports[0].server_port_min, "%s", options); | 1225 | reply->transports[0].server_port_min, "%s", options); |
| 1226 | } | 1226 | } |
| 1227 | if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && | 1227 | if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && |
| 1228 | rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) { | 1228 | ff_rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) { |
| 1229 | err = AVERROR_INVALIDDATA; | 1229 | err = AVERROR_INVALIDDATA; |
| 1230 | goto fail; | 1230 | goto fail; |
| 1231 | } | 1231 | } |
| @@ -1235,7 +1235,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, · 3 unmodified lines | |||
| 1235 | */ | 1235 | */ |
| 1236 | if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat && | 1236 | if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat && |
| 1237 | CONFIG_RTPDEC) | 1237 | CONFIG_RTPDEC) |
| 1238 | rtp_send_punch_packets(rtsp_st->rtp_handle); | 1238 | ff_rtp_send_punch_packets(rtsp_st->rtp_handle); |
| 1239 | break; | 1239 | break; |
| 1240 | } | 1240 | } |
| 1241 | case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: { | 1241 | case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: { |
| @@ -1569,7 +1569,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, · 327 unmodified lines | |||
| 1569 | if (rtsp_st->rtp_handle) { | 1569 | if (rtsp_st->rtp_handle) { |
| 1570 | p[max_p].fd = ffurl_get_file_handle(rtsp_st->rtp_handle); | 1570 | p[max_p].fd = ffurl_get_file_handle(rtsp_st->rtp_handle); |
| 1571 | p[max_p++].events = POLLIN; | 1571 | p[max_p++].events = POLLIN; |
| 1572 | p[max_p].fd = rtp_get_rtcp_file_handle(rtsp_st->rtp_handle); | 1572 | p[max_p].fd = ff_rtp_get_rtcp_file_handle(rtsp_st->rtp_handle); |
| 1573 | p[max_p++].events = POLLIN; | 1573 | p[max_p++].events = POLLIN; |
| 1574 | } | 1574 | } |
| 1575 | } | 1575 | } |
| @@ -1624,7 +1624,7 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) · 48 unmodified lines | |||
| 1624 | if (rt->transport == RTSP_TRANSPORT_RDT) { | 1624 | if (rt->transport == RTSP_TRANSPORT_RDT) { |
| 1625 | ret = ff_rdt_parse_packet(rt->cur_transport_priv, pkt, NULL, 0); | 1625 | ret = ff_rdt_parse_packet(rt->cur_transport_priv, pkt, NULL, 0); |
| 1626 | } else | 1626 | } else |
| 1627 | ret = rtp_parse_packet(rt->cur_transport_priv, pkt, NULL, 0); | 1627 | ret = ff_rtp_parse_packet(rt->cur_transport_priv, pkt, NULL, 0); |
| 1628 | if (ret == 0) { | 1628 | if (ret == 0) { |
| 1629 | rt->cur_transport_priv = NULL; | 1629 | rt->cur_transport_priv = NULL; |
| 1630 | return 0; | 1630 | return 0; |
| @@ -1672,13 +1672,13 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) · 41 unmodified lines | |||
| 1672 | case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: | 1672 | case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: |
| 1673 | len = udp_read_packet(s, &rtsp_st, rt->recvbuf, RECVBUF_SIZE, wait_end); | 1673 | len = udp_read_packet(s, &rtsp_st, rt->recvbuf, RECVBUF_SIZE, wait_end); |
| 1674 | if (len > 0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP) | 1674 | if (len > 0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP) |
| 1675 | rtp_check_and_send_back_rr(rtsp_st->transport_priv, len); | 1675 | ff_rtp_check_and_send_back_rr(rtsp_st->transport_priv, len); |
| 1676 | break; | 1676 | break; |
| 1677 | } | 1677 | } |
| 1678 | if (len == AVERROR(EAGAIN) && first_queue_st && | 1678 | if (len == AVERROR(EAGAIN) && first_queue_st && |
| 1679 | rt->transport == RTSP_TRANSPORT_RTP) { | 1679 | rt->transport == RTSP_TRANSPORT_RTP) { |
| 1680 | rtsp_st = first_queue_st; | 1680 | rtsp_st = first_queue_st; |
| 1681 | ret = rtp_parse_packet(rtsp_st->transport_priv, pkt, NULL, 0); | 1681 | ret = ff_rtp_parse_packet(rtsp_st->transport_priv, pkt, NULL, 0); |
| 1682 | goto end; | 1682 | goto end; |
| 1683 | } | 1683 | } |
| 1684 | if (len < 0) | 1684 | if (len < 0) |
| @@ -1688,7 +1688,7 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) · 3 unmodified lines | |||
| 1688 | if (rt->transport == RTSP_TRANSPORT_RDT) { | 1688 | if (rt->transport == RTSP_TRANSPORT_RDT) { |
| 1689 | ret = ff_rdt_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len); | 1689 | ret = ff_rdt_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len); |
| 1690 | } else { | 1690 | } else { |
| 1691 | ret = rtp_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len); | 1691 | ret = ff_rtp_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len); |
| 1692 | if (ret < 0) { | 1692 | if (ret < 0) { |
| 1693 | /* Either bad packet, or a RTCP packet. Check if the | 1693 | /* Either bad packet, or a RTCP packet. Check if the |
| 1694 | * first_rtcp_ntp_time field was initialized. */ | 1694 | * first_rtcp_ntp_time field was initialized. */ |