History

avformat/dss: Remove unnecessary allocation

Put a buffer with a known fixed size into the demuxer's context instead of allocating it separately. This also allows to remove the demuxer's read_close()-function.

Andreas Rheinhardt committed 6 years ago

Commit aebf3141 parent ab502fa1 file · +1 −15Browse files

Unified · Split

libavformat/dss.c+1−15
@@ -50,7 +50,7 @@ typedef struct DSSDemuxContext { · 49 unmodified lines
5050 int counter;
5151 int swap;
5252 int dss_sp_swap_byte;
53− int8_t *dss_sp_buf;
53+ int8_t dss_sp_buf[DSS_FRAME_SIZE + 1];
5454
5555 int packet_size;
5656 int dss_header_size;
@@ -168,10 +168,6 @@ static int dss_read_header(AVFormatContext *s) · 111 unmodified lines
168168 ctx->counter = 0;
169169 ctx->swap = 0;
170170
171− ctx->dss_sp_buf = av_malloc(DSS_FRAME_SIZE + 1);
172− if (!ctx->dss_sp_buf)
173− return AVERROR(ENOMEM);
174−
175171 return 0;
176172 }
177173
@@ -327,15 +323,6 @@ static int dss_read_packet(AVFormatContext *s, AVPacket *pkt) · 149 unmodified lines
327323 return dss_723_1_read_packet(s, pkt);
328324 }
329325
330−static int dss_read_close(AVFormatContext *s)
331−{
332− DSSDemuxContext *ctx = s->priv_data;
333−
334− av_freep(&ctx->dss_sp_buf);
335−
336− return 0;
337−}
338−
339326 static int dss_read_seek(AVFormatContext *s, int stream_index,
340327 int64_t timestamp, int flags)
341328 {
@@ -382,7 +369,6 @@ AVInputFormat ff_dss_demuxer = { · 40 unmodified lines
382369 .read_probe = dss_probe,
383370 .read_header = dss_read_header,
384371 .read_packet = dss_read_packet,
385− .read_close = dss_read_close,
386372 .read_seek = dss_read_seek,
387373 .extensions = "dss"
388374 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t