Ticket #916: 0001-fix-rtp-916-issue.patch

File 0001-fix-rtp-916-issue.patch, 2.2 KB (added by Dmitry Volyntsev, 14 years ago)

final committed patch 1

  • libavformat/rtsp.c

    From 2b33369c032b210e9ef2ece7bfdd29eef30e2f15 Mon Sep 17 00:00:00 2001
    From: Dmitry Volyntsev <xeioexception@gmail.com>
    Date: Wed, 18 Jan 2012 13:46:37 +0400
    Subject: [PATCH 1/2] fix rtp 916 issue
    
    ---
     libavformat/rtsp.c |    8 +++++---
     libavformat/rtsp.h |    2 +-
     2 files changed, 6 insertions(+), 4 deletions(-)
    
    diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
    index d32f49e..ff1f857 100644
    a b int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,  
    11031103                              int lower_transport, const char *real_challenge)
    11041104{
    11051105    RTSPState *rt = s->priv_data;
    1106     int rtx = 0, j, i, err, interleave = 0;
     1106    int rtx = 0, j, i, err, interleave = 0, port_off;
    11071107    RTSPStream *rtsp_st;
    11081108    RTSPMessageHeader reply1, *reply = &reply1;
    11091109    char cmd[2048];
    int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,  
    11201120    /* for each stream, make the setup request */
    11211121    /* XXX: we assume the same server is used for the control of each
    11221122     * RTSP stream */
     1123    port_off = av_get_random_seed() % (RTSP_RTP_PORT_MAX - RTSP_RTP_PORT_MIN);
     1124    /* even random offset */
     1125    port_off -= port_off & 0x01;
    11231126
    1124     for (j = RTSP_RTP_PORT_MIN, i = 0; i < rt->nb_rtsp_streams; ++i) {
     1127    for (j = RTSP_RTP_PORT_MIN + port_off, i = 0; i < rt->nb_rtsp_streams; ++i) {
    11251128        char transport[2048];
    11261129
    11271130        /*
    int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,  
    11691172                        goto rtp_opened;
    11701173                }
    11711174            }
    1172 
    11731175            av_log(s, AV_LOG_ERROR, "Unable to open an input RTP port\n");
    11741176            err = AVERROR(EIO);
    11751177            goto fail;
  • libavformat/rtsp.h

    diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
    index 36de7e5..e11dec9 100644
    a b enum RTSPControlTransport {  
    7070#define RTSP_DEFAULT_NB_AUDIO_CHANNELS 1
    7171#define RTSP_DEFAULT_AUDIO_SAMPLERATE 44100
    7272#define RTSP_RTP_PORT_MIN 5000
    73 #define RTSP_RTP_PORT_MAX 10000
     73#define RTSP_RTP_PORT_MAX 65000
    7474
    7575/**
    7676 * This describes a single item in the "Transport:" line of one stream as