Revision b7dc88fc libavformat/rtsp.c

View differences:

libavformat/rtsp.c
584 584
                if (s->oformat) {
585 585
                    AVFormatContext *rtpctx = rtsp_st->transport_priv;
586 586
                    av_write_trailer(rtpctx);
587
                    if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) {
588
                        uint8_t *ptr;
589
                        url_close_dyn_buf(rtpctx->pb, &ptr);
590
                        av_free(ptr);
591
                    } else {
587 592
                    url_fclose(rtpctx->pb);
593
                    }
588 594
                    av_metadata_free(&rtpctx->streams[0]->metadata);
589 595
                    av_metadata_free(&rtpctx->metadata);
590 596
                    av_free(rtpctx->streams[0]);
......
644 650
    av_free(rtpctx->streams[0]->codec);
645 651
    rtpctx->streams[0]->codec = st->codec;
646 652

  
653
    if (handle) {
647 654
    url_fdopen(&rtpctx->pb, handle);
655
    } else
656
        url_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);
648 657
    ret = av_write_header(rtpctx);
649 658

  
650 659
    if (ret) {
660
        if (handle) {
651 661
        url_fclose(rtpctx->pb);
662
        } else {
663
            uint8_t *ptr;
664
            url_close_dyn_buf(rtpctx->pb, &ptr);
665
            av_free(ptr);
666
        }
652 667
        av_free(rtpctx->streams[0]);
653 668
        av_free(rtpctx);
654 669
        return NULL;
......
1464 1479
        lower_transport_mask = (1 << RTSP_LOWER_TRANSPORT_NB) - 1;
1465 1480

  
1466 1481
    if (s->oformat) {
1467
        /* Only UDP output is supported at the moment. */
1468
        lower_transport_mask &= 1 << RTSP_LOWER_TRANSPORT_UDP;
1482
        /* Only UDP or TCP - UDP multicast isn't supported. */
1483
        lower_transport_mask &= (1 << RTSP_LOWER_TRANSPORT_UDP) |
1484
                                (1 << RTSP_LOWER_TRANSPORT_TCP);
1469 1485
        if (!lower_transport_mask) {
1470 1486
            av_log(s, AV_LOG_ERROR, "Unsupported lower transport method, "
1471
                                    "only UDP is supported for output.\n");
1487
                                    "only UDP and TCP are supported for output.\n");
1472 1488
            err = AVERROR(EINVAL);
1473 1489
            goto fail;
1474 1490
        }

Also available in: Unified diff