Message ID | 20200710210149.6969-2-jamrial@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [FFmpeg-devel,1/3] avcodec/libx264: use a function to parse x264opts | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | fail | Make failed |
On 7/10/2020 6:01 PM, James Almer wrote: > And return the proper AVERROR value. > > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavcodec/libx264.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > index 4a82e1ba25..b39b89b565 100644 > --- a/libavcodec/libx264.c > +++ b/libavcodec/libx264.c > @@ -529,6 +529,12 @@ static int parse_opts(AVCodecContext *avctx, const char *opt, const char *param) > av_log(avctx, AV_LOG_ERROR, > "bad option '%s': '%s'\n", opt, param); > ret = AVERROR(EINVAL); > +#if X264_BUILD >= 161 > + } else if (ret == X264_PARAM_ALLOC_FAILED) { > + av_log(avctx, AV_LOG_ERROR, > + "out of memory parsing option '%s': '%s'\n", opt, param); > + ret = AVERROR(ENOMEM); > +#endif > } else { > av_log(avctx, AV_LOG_ERROR, > "bad value for '%s': '%s'\n", opt, param); > @@ -914,10 +920,13 @@ FF_ENABLE_DEPRECATION_WARNINGS > { > AVDictionaryEntry *en = NULL; > while (en = av_dict_get(x4->x264_params, "", en, AV_DICT_IGNORE_SUFFIX)) { > - if (x264_param_parse(&x4->params, en->key, en->value) < 0) > + if ((ret = x264_param_parse(&x4->params, en->key, en->value)) < 0) { > av_log(avctx, AV_LOG_WARNING, > "Error parsing option '%s = %s'.\n", > en->key, en->value); > + if (ret == X264_PARAM_ALLOC_FAILED) Added missing X264_BUILD check locally. > + return AVERROR(ENOMEM); > + } > } > } > >
Am Fr., 10. Juli 2020 um 23:02 Uhr schrieb James Almer <jamrial@gmail.com>: > > And return the proper AVERROR value. > > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavcodec/libx264.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > index 4a82e1ba25..b39b89b565 100644 > --- a/libavcodec/libx264.c > +++ b/libavcodec/libx264.c > @@ -529,6 +529,12 @@ static int parse_opts(AVCodecContext *avctx, const char *opt, const char *param) > av_log(avctx, AV_LOG_ERROR, > "bad option '%s': '%s'\n", opt, param); > ret = AVERROR(EINVAL); > +#if X264_BUILD >= 161 > + } else if (ret == X264_PARAM_ALLOC_FAILED) { Why are these lines not merged? > + av_log(avctx, AV_LOG_ERROR, > + "out of memory parsing option '%s': '%s'\n", opt, param); > + ret = AVERROR(ENOMEM); > +#endif Carl Eugen
On 7/10/2020 7:26 PM, Carl Eugen Hoyos wrote: > Am Fr., 10. Juli 2020 um 23:02 Uhr schrieb James Almer <jamrial@gmail.com>: >> >> And return the proper AVERROR value. >> >> Signed-off-by: James Almer <jamrial@gmail.com> >> --- >> libavcodec/libx264.c | 11 ++++++++++- >> 1 file changed, 10 insertions(+), 1 deletion(-) >> >> diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c >> index 4a82e1ba25..b39b89b565 100644 >> --- a/libavcodec/libx264.c >> +++ b/libavcodec/libx264.c >> @@ -529,6 +529,12 @@ static int parse_opts(AVCodecContext *avctx, const char *opt, const char *param) >> av_log(avctx, AV_LOG_ERROR, >> "bad option '%s': '%s'\n", opt, param); >> ret = AVERROR(EINVAL); >> +#if X264_BUILD >= 161 >> + } else if (ret == X264_PARAM_ALLOC_FAILED) { > > Why are these lines not merged? If you mean adding the X264_BUILD check inside the if, because X264_PARAM_ALLOC_FAILED is not defined in x264.h before the commit that bumped X264_BUILD to 161. if (X264_BUILD >= 161 && ret == X264_PARAM_ALLOC_FAILED) Does not compile with old libx264 headers. If it's not that, then not sure what you mean. > >> + av_log(avctx, AV_LOG_ERROR, >> + "out of memory parsing option '%s': '%s'\n", opt, param); >> + ret = AVERROR(ENOMEM); >> +#endif > > Carl Eugen > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". >
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 4a82e1ba25..b39b89b565 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -529,6 +529,12 @@ static int parse_opts(AVCodecContext *avctx, const char *opt, const char *param) av_log(avctx, AV_LOG_ERROR, "bad option '%s': '%s'\n", opt, param); ret = AVERROR(EINVAL); +#if X264_BUILD >= 161 + } else if (ret == X264_PARAM_ALLOC_FAILED) { + av_log(avctx, AV_LOG_ERROR, + "out of memory parsing option '%s': '%s'\n", opt, param); + ret = AVERROR(ENOMEM); +#endif } else { av_log(avctx, AV_LOG_ERROR, "bad value for '%s': '%s'\n", opt, param); @@ -914,10 +920,13 @@ FF_ENABLE_DEPRECATION_WARNINGS { AVDictionaryEntry *en = NULL; while (en = av_dict_get(x4->x264_params, "", en, AV_DICT_IGNORE_SUFFIX)) { - if (x264_param_parse(&x4->params, en->key, en->value) < 0) + if ((ret = x264_param_parse(&x4->params, en->key, en->value)) < 0) { av_log(avctx, AV_LOG_WARNING, "Error parsing option '%s = %s'.\n", en->key, en->value); + if (ret == X264_PARAM_ALLOC_FAILED) + return AVERROR(ENOMEM); + } } }
And return the proper AVERROR value. Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/libx264.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)