diff options
author | Martin Storsjö <martin@martin.st> | 2010-02-26 16:21:56 +0000 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2010-02-26 16:21:56 +0000 |
commit | 50ff78db019bb4ac77d546c53bd785def81394f8 (patch) | |
tree | 0e437f2e3ea9e75ec6d3340e72434df359413541 /libavformat | |
parent | cf41a02b1bac717d3adac1def9a531dc9d078b4a (diff) | |
download | ffmpeg-50ff78db019bb4ac77d546c53bd785def81394f8.tar.gz |
RTSP muxer: Use a local copy of the AVPacket for sending to the chained muxer
This way, we avoid overwriting stream_index in the user's AVPacket
with a nonsense value.
Originally committed as revision 22081 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/rtspenc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index 886664ca5a..c655e70a98 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -71,6 +71,7 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt) int n, tcp_fd; struct timeval tv; AVFormatContext *rtpctx; + AVPacket local_pkt; FD_ZERO(&rfds); tcp_fd = url_get_file_handle(rt->rtsp_hd); @@ -96,8 +97,11 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt) rtsp_st = rt->rtsp_streams[pkt->stream_index]; rtpctx = rtsp_st->transport_priv; - pkt->stream_index = 0; - return av_write_frame(rtpctx, pkt); + /* Use a local packet for writing to the chained muxer, otherwise + * the internal stream_index = 0 becomes visible to the muxer user. */ + local_pkt = *pkt; + local_pkt.stream_index = 0; + return av_write_frame(rtpctx, &local_pkt); } static int rtsp_write_close(AVFormatContext *s) |