[FFmpeg-devel] [PATCH] Make avfilter_unref_buffer() accept a NULL parameter.
Stefano Sabatini
stefano.sabatini-lala
Sat Jan 15 12:48:33 CET 2011
---
libavfilter/af_aconvert.c | 2 +-
libavfilter/avfilter.c | 2 ++
libavfilter/avfilter.h | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavfilter/af_aconvert.c b/libavfilter/af_aconvert.c
index b352d41..ac40db6 100644
--- a/libavfilter/af_aconvert.c
+++ b/libavfilter/af_aconvert.c
@@ -139,7 +139,7 @@ static int config_props(AVFilterLink *inlink)
if (convert->out_sample_fmt == -1)
convert->out_sample_fmt = outlink->format;
if (convert->out_channel_layout == -1)
- convert->out_channel_layout = outlink->channel_layout;
+ convert->out_channel_layout = inlink->channel_layout;
outlink->format = convert->out_sample_fmt;
outlink->channel_layout = convert->out_channel_layout;
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 9812610..b19054b 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -71,6 +71,8 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
void avfilter_unref_buffer(AVFilterBufferRef *ref)
{
+ if (!buf)
+ return;
if (!(--ref->buf->refcount))
ref->buf->free(ref->buf);
av_free(ref->video);
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 15d440a..d2a275e 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -177,7 +177,7 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask);
* Remove a reference to a buffer. If this is the last reference to the
* buffer, the buffer itself is also automatically freed.
*
- * @param ref reference to the buffer
+ * @param ref reference to the buffer, may be NULL
*/
void avfilter_unref_buffer(AVFilterBufferRef *ref);
--
1.7.2.3
More information about the ffmpeg-devel
mailing list