[FFmpeg-devel] [PATCH 2/2] lavfi: check that buffer and link properties match.

Nicolas George nicolas.george at normalesup.org
Thu Sep 13 17:19:57 CEST 2012


Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavfilter/audio.c |    4 ++++
 libavfilter/video.c |    4 ++++
 2 files changed, 8 insertions(+)


With the previous patch, FATE succeeds, including for amix.


diff --git a/libavfilter/audio.c b/libavfilter/audio.c
index ae78ed8..06702a6 100644
--- a/libavfilter/audio.c
+++ b/libavfilter/audio.c
@@ -225,6 +225,10 @@ int ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
     int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);
     int ret = 0;
 
+    av_assert1(samplesref->format                == link->format);
+    av_assert1(samplesref->audio->channel_layout == link->channel_layout);
+    av_assert1(samplesref->audio->sample_rate    == link->sample_rate);
+
     if (!link->min_samples ||
         (!pbuf &&
          insamples >= link->min_samples && insamples <= link->max_samples)) {
diff --git a/libavfilter/video.c b/libavfilter/video.c
index 5294c1b..d0c95cd 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -249,6 +249,10 @@ int ff_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
 
     FF_TPRINTF_START(NULL, start_frame); ff_tlog_link(NULL, link, 0); ff_tlog(NULL, " "); ff_tlog_ref(NULL, picref, 1);
 
+    av_assert1(picref->format                     == link->format);
+    av_assert1(picref->video->w                   == link->w);
+    av_assert1(picref->video->h                   == link->h);
+
     if (link->closed) {
         avfilter_unref_buffer(picref);
         return AVERROR_EOF;
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list