aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/audiointerleave.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-20 00:22:48 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-20 00:22:51 +0200
commit6218831844fa5a517eda857adee7960aa0a9c033 (patch)
treeef558092b7894d7f51b14af46203f17ddea49bb6 /libavformat/audiointerleave.c
parentab6228316a595ecc1ee462a34a4f19e1ffeb9062 (diff)
parentb9419b58826effc3d9afabd1a2e50d66391fbdbf (diff)
downloadffmpeg-6218831844fa5a517eda857adee7960aa0a9c033.tar.gz
Merge remote-tracking branch 'lukaszmluki/master'
* lukaszmluki/master: lavf/ftp: favour EPSV over PASV command lavf/audiointerleave: return more meaningful error codes lavf/audiointerleave: check for allocation failure lavf/audiointerleave: use av_fifo_alloc_array lavf/dvenc: use av_fifo_alloc_array lavc/flac_parser: use av_fifo_alloc_array lavc/frame_thread_encoder: use av_fifo_alloc_array lavfi/vf_fps: use av_fifo_alloc_array lavfi/buffersink: use av_fifo_alloc_array ffmpeg: use av_fifo_alloc_array lavd/jack_audio: use av_fifo_alloc_array lavu/fifo: add av_fifo_alloc_array function Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/audiointerleave.c')
-rw-r--r--libavformat/audiointerleave.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavformat/audiointerleave.c b/libavformat/audiointerleave.c
index 6d24ff5c7f..7f580b970d 100644
--- a/libavformat/audiointerleave.c
+++ b/libavformat/audiointerleave.c
@@ -45,11 +45,11 @@ int ff_audio_interleave_init(AVFormatContext *s,
int i;
if (!samples_per_frame)
- return -1;
+ return AVERROR(EINVAL);
if (!time_base.num) {
av_log(s, AV_LOG_ERROR, "timebase not set for audio interleave\n");
- return -1;
+ return AVERROR(EINVAL);
}
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
@@ -60,14 +60,15 @@ int ff_audio_interleave_init(AVFormatContext *s,
av_get_bits_per_sample(st->codec->codec_id)) / 8;
if (!aic->sample_size) {
av_log(s, AV_LOG_ERROR, "could not compute sample size\n");
- return -1;
+ return AVERROR(EINVAL);
}
aic->samples_per_frame = samples_per_frame;
aic->samples = aic->samples_per_frame;
aic->time_base = time_base;
aic->fifo_size = 100* *aic->samples;
- aic->fifo= av_fifo_alloc(100 * *aic->samples);
+ if (!(aic->fifo= av_fifo_alloc_array(100, *aic->samples)))
+ return AVERROR(ENOMEM);
}
}
@@ -113,7 +114,7 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt
unsigned new_size = av_fifo_size(aic->fifo) + pkt->size;
if (new_size > aic->fifo_size) {
if (av_fifo_realloc2(aic->fifo, new_size) < 0)
- return -1;
+ return AVERROR(ENOMEM);
aic->fifo_size = new_size;
}
av_fifo_generic_write(aic->fifo, pkt->data, pkt->size, NULL);