Re: [FFmpeg-devel] [PATCH] lavc/libopusdec: Allow avcodec_open2 to call .close

2018-04-10 Thread Michael Niedermayer
On Wed, Apr 11, 2018 at 12:43:21AM +0200, Michael Niedermayer wrote:
> On Tue, Apr 10, 2018 at 02:13:28PM -0700, Matthew Wolenetz wrote:
> > 
> 
> >  libopusdec.c |6 +-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > a62bece9f45c68d93e138cb021a533fbc242ddc3  
> > 0001-lavc-libopusdec-Allow-avcodec_open2-to-call-.close.patch
> > From 031e96bd481b7b8d0c11e5353f74fafc69e37f09 Mon Sep 17 00:00:00 2001
> > From: Matt Wolenetz 
> > Date: Tue, 10 Apr 2018 13:59:25 -0700
> > Subject: [PATCH] lavc/libopusdec: Allow avcodec_open2 to call .close
> > 
> > If there is a decoder initialization failure detected in avcodec_open2
> > after .init is called, allow graceful decoder .close to prevent leaking
> > libopus decoder allocations.
> > 
> > BUG=828526
> > ---
> >  libavcodec/libopusdec.c | 6 +-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> Doesnt apply, also the NULL check already exists in git master
> FF_CODEC_CAP_INIT_CLEANUP is missing in master though
> 
> can you update the patch ?

forget this, will apply your patch

i had this applied locally and didnt realize, i even checked
what patches i had on the changed file, somehow i must have
done something silly

commit 4614d94f049319353f6c9deba1079009dd85594c 
Author: Andrew Allen 
Date:   Wed Mar 28 14:48:46 2018 -0700

Support for Ambisonics and OpusProjection* API.

Signed-off-by: Michael Niedermayer 


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/libopusdec: Allow avcodec_open2 to call .close

2018-04-10 Thread Michael Niedermayer
On Tue, Apr 10, 2018 at 02:13:28PM -0700, Matthew Wolenetz wrote:
> 

>  libopusdec.c |6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> a62bece9f45c68d93e138cb021a533fbc242ddc3  
> 0001-lavc-libopusdec-Allow-avcodec_open2-to-call-.close.patch
> From 031e96bd481b7b8d0c11e5353f74fafc69e37f09 Mon Sep 17 00:00:00 2001
> From: Matt Wolenetz 
> Date: Tue, 10 Apr 2018 13:59:25 -0700
> Subject: [PATCH] lavc/libopusdec: Allow avcodec_open2 to call .close
> 
> If there is a decoder initialization failure detected in avcodec_open2
> after .init is called, allow graceful decoder .close to prevent leaking
> libopus decoder allocations.
> 
> BUG=828526
> ---
>  libavcodec/libopusdec.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Doesnt apply, also the NULL check already exists in git master
FF_CODEC_CAP_INIT_CLEANUP is missing in master though

can you update the patch ?

thx
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavc/libopusdec: Allow avcodec_open2 to call .close

2018-04-10 Thread Matthew Wolenetz

From 031e96bd481b7b8d0c11e5353f74fafc69e37f09 Mon Sep 17 00:00:00 2001
From: Matt Wolenetz 
Date: Tue, 10 Apr 2018 13:59:25 -0700
Subject: [PATCH] lavc/libopusdec: Allow avcodec_open2 to call .close

If there is a decoder initialization failure detected in avcodec_open2
after .init is called, allow graceful decoder .close to prevent leaking
libopus decoder allocations.

BUG=828526
---
 libavcodec/libopusdec.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libopusdec.c b/libavcodec/libopusdec.c
index 3d2ee5b61b..2a97811d18 100644
--- a/libavcodec/libopusdec.c
+++ b/libavcodec/libopusdec.c
@@ -160,7 +160,10 @@ static av_cold int libopus_decode_close(AVCodecContext *avc)
 {
 struct libopus_context *opus = avc->priv_data;
 
-opus_multistream_decoder_destroy(opus->dec);
+if (opus->dec) {
+opus_multistream_decoder_destroy(opus->dec);
+opus->dec = NULL;
+}
 return 0;
 }
 
@@ -252,6 +255,7 @@ AVCodec ff_libopus_decoder = {
 .decode = libopus_decode,
 .flush  = libopus_flush,
 .capabilities   = AV_CODEC_CAP_DR1,
+.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 .sample_fmts= (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
  AV_SAMPLE_FMT_S16,
  AV_SAMPLE_FMT_NONE },
-- 
2.17.0.484.g0c8726318c-goog

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel