[FFmpeg-devel] [PATCH 2/3] ffmpeg: allocate filtered_frame in transcode_init.
Nicolas George
nicolas.george at normalesup.org
Sun Aug 19 17:53:15 CEST 2012
With that change, reap_filters can no longer fail.
The return value (always 0) is left for call sites using
"return reap_filters()".
Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
ffmpeg.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/ffmpeg.c b/ffmpeg.c
index bace20c..0d8abb4 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -954,7 +954,7 @@ static void do_video_stats(AVFormatContext *os, OutputStream *ost,
* Get and encode new output from any of the filtergraphs, without causing
* activity.
*
- * @return 0 for success, <0 for severe errors
+ * @return 0 for success, no error possible
*/
static int reap_filters(void)
{
@@ -972,10 +972,7 @@ static int reap_filters(void)
if (!ost->filter)
continue;
- if (!ost->filtered_frame && !(ost->filtered_frame = avcodec_alloc_frame())) {
- return AVERROR(ENOMEM);
- } else
- avcodec_get_frame_defaults(ost->filtered_frame);
+ avcodec_get_frame_defaults(ost->filtered_frame);
filtered_frame = ost->filtered_frame;
while (1) {
@@ -2120,6 +2117,13 @@ static int transcode_init(void)
}
}
+ if (ost->filter) {
+ if (!(ost->filtered_frame = avcodec_alloc_frame())) {
+ av_log(NULL, AV_LOG_FATAL, "Out of memory\n");
+ exit_program(1);
+ }
+ }
+
if (codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if (ost->filter && !ost->frame_rate.num)
ost->frame_rate = av_buffersink_get_frame_rate(ost->filter->filter);
--
1.7.10.4
More information about the ffmpeg-devel
mailing list