mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
RTSP muxer: Create the SDP with the numerical IP of the peer
instead of using the original host name Originally committed as revision 22464 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
d8b91fae1d
commit
26cb700c82
@ -1328,13 +1328,14 @@ static int rtsp_setup_input_streams(AVFormatContext *s)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtsp_setup_output_streams(AVFormatContext *s)
|
static int rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
|
||||||
{
|
{
|
||||||
RTSPState *rt = s->priv_data;
|
RTSPState *rt = s->priv_data;
|
||||||
RTSPMessageHeader reply1, *reply = &reply1;
|
RTSPMessageHeader reply1, *reply = &reply1;
|
||||||
char cmd[1024];
|
char cmd[1024];
|
||||||
int i;
|
int i;
|
||||||
char *sdp;
|
char *sdp;
|
||||||
|
AVFormatContext sdp_ctx, *ctx_array[1];
|
||||||
|
|
||||||
/* Announce the stream */
|
/* Announce the stream */
|
||||||
snprintf(cmd, sizeof(cmd),
|
snprintf(cmd, sizeof(cmd),
|
||||||
@ -1344,7 +1345,23 @@ static int rtsp_setup_output_streams(AVFormatContext *s)
|
|||||||
sdp = av_mallocz(8192);
|
sdp = av_mallocz(8192);
|
||||||
if (sdp == NULL)
|
if (sdp == NULL)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
if (avf_sdp_create(&s, 1, sdp, 8192)) {
|
/* We create the SDP based on the RTSP AVFormatContext where we
|
||||||
|
* aren't allowed to change the filename field. (We create the SDP
|
||||||
|
* based on the RTSP context since the contexts for the RTP streams
|
||||||
|
* don't exist yet.) In order to specify a custom URL with the actual
|
||||||
|
* peer IP instead of the originally specified hostname, we create
|
||||||
|
* a temporary copy of the AVFormatContext, where the custom URL is set.
|
||||||
|
*
|
||||||
|
* FIXME: Create the SDP without copying the AVFormatContext.
|
||||||
|
* This either requires setting up the RTP stream AVFormatContexts
|
||||||
|
* already here (complicating things immensely) or getting a more
|
||||||
|
* flexible SDP creation interface.
|
||||||
|
*/
|
||||||
|
sdp_ctx = *s;
|
||||||
|
ff_url_join(sdp_ctx.filename, sizeof(sdp_ctx.filename),
|
||||||
|
"rtsp", NULL, addr, -1, NULL);
|
||||||
|
ctx_array[0] = &sdp_ctx;
|
||||||
|
if (avf_sdp_create(ctx_array, 1, sdp, 8192)) {
|
||||||
av_free(sdp);
|
av_free(sdp);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
@ -1507,7 +1524,7 @@ redirect:
|
|||||||
if (s->iformat)
|
if (s->iformat)
|
||||||
err = rtsp_setup_input_streams(s);
|
err = rtsp_setup_input_streams(s);
|
||||||
else
|
else
|
||||||
err = rtsp_setup_output_streams(s);
|
err = rtsp_setup_output_streams(s, host);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user