aboutsummaryrefslogtreecommitdiff
path: root/ffserver.c
diff options
context:
space:
mode:
authorMichael Niedermayer2016-11-27 19:13:56 +0100
committerMichael Niedermayer2016-11-28 22:45:38 +0100
commit0dbee67700393b9e2a84e5570294209b1f2a985c (patch)
tree5ec4d01d1dae97b378f1daa5ea6c3f1404494cee /ffserver.c
parentda38da459598c0a8777522720b6a4afd433e29bc (diff)
ffserver: Remove last use of AVStream size
Reviewed-by: "Reynaldo H. Verdejo Pinochet" <reynaldo@osg.samsung.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'ffserver.c')
-rw-r--r--ffserver.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/ffserver.c b/ffserver.c
index ded514918f..9b1f6d5591 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);
}