[FFmpeg-cvslog] ffserver: Remove last use of AVStream size
Michael Niedermayer
git at videolan.org
Mon Nov 28 23:48:52 EET 2016
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Nov 27 19:13:56 2016 +0100| [0dbee67700393b9e2a84e5570294209b1f2a985c] | committer: Michael Niedermayer
ffserver: Remove last use of AVStream size
Reviewed-by: "Reynaldo H. Verdejo Pinochet" <reynaldo at osg.samsung.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0dbee67700393b9e2a84e5570294209b1f2a985c
---
ffserver.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/ffserver.c b/ffserver.c
index ded5149..9b1f6d5 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -2961,7 +2961,6 @@ static int prepare_sdp_description(FFServerStream *stream, uint8_t **pbuffer,
struct in_addr my_ip)
{
AVFormatContext *avc;
- AVStream *avs = NULL;
AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
AVDictionaryEntry *entry = av_dict_get(stream->metadata, "title", NULL, 0);
int i;
@@ -2975,7 +2974,6 @@ static int prepare_sdp_description(FFServerStream *stream, uint8_t **pbuffer,
avc->oformat = rtp_format;
av_dict_set(&avc->metadata, "title",
entry ? entry->value : "No Title", 0);
- avc->nb_streams = stream->nb_streams;
if (stream->is_multicast) {
snprintf(avc->filename, 1024, "rtp://%s:%d?multicast=1?ttl=%d",
inet_ntoa(stream->multicast_ip),
@@ -2983,19 +2981,12 @@ static int prepare_sdp_description(FFServerStream *stream, uint8_t **pbuffer,
} else
snprintf(avc->filename, 1024, "rtp://0.0.0.0");
- avc->streams = av_malloc_array(avc->nb_streams, sizeof(*avc->streams));
- if (!avc->streams)
- goto sdp_done;
-
- avs = av_malloc_array(avc->nb_streams, sizeof(*avs));
- if (!avs)
- goto sdp_done;
-
for(i = 0; i < stream->nb_streams; i++) {
- avc->streams[i] = &avs[i];
- avc->streams[i]->codec = stream->streams[i]->codec;
+ AVStream *st = avformat_new_stream(avc, NULL);
+ if (!st)
+ goto sdp_done;
avcodec_parameters_from_context(stream->streams[i]->codecpar, stream->streams[i]->codec);
- avc->streams[i]->codecpar = stream->streams[i]->codecpar;
+ unlayer_stream(st, stream->streams[i]);
}
#define PBUFFER_SIZE 2048
*pbuffer = av_mallocz(PBUFFER_SIZE);
@@ -3007,7 +2998,6 @@ static int prepare_sdp_description(FFServerStream *stream, uint8_t **pbuffer,
av_freep(&avc->streams);
av_dict_free(&avc->metadata);
av_free(avc);
- av_free(avs);
return *pbuffer ? strlen(*pbuffer) : AVERROR(ENOMEM);
}
More information about the ffmpeg-cvslog
mailing list