[vlc-devel] [PATCH] aout: Do not try to resample without filter

Julian Scheel julian at jusst.de
Thu Dec 22 11:42:16 CET 2016


If no resampling filter is available it makes no sense to try to
resample the audio to compensate for a clock drift. This avoids two
warnings for each call of aout_DecSynchronize, because it tries to start
resampling just to stop it immediately because no filter is available.

Signed-off-by: Julian Scheel <julian at jusst.de>
---
 include/vlc_aout.h         | 1 +
 src/audio_output/dec.c     | 3 +++
 src/audio_output/filters.c | 5 +++++
 src/libvlccore.sym         | 1 +
 4 files changed, 10 insertions(+)

diff --git a/include/vlc_aout.h b/include/vlc_aout.h
index bbe7b4c..d82922b 100644
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -339,6 +339,7 @@ VLC_API aout_filters_t *aout_FiltersNew(vlc_object_t *,
 VLC_API void aout_FiltersDelete(vlc_object_t *, aout_filters_t *);
 #define aout_FiltersDelete(o,f) \
         aout_FiltersDelete(VLC_OBJECT(o),f)
+VLC_API bool aout_FiltersCanResample (aout_filters_t *filters);
 VLC_API bool aout_FiltersAdjustResampling(aout_filters_t *, int);
 VLC_API block_t *aout_FiltersPlay(aout_filters_t *, block_t *, int rate);
 VLC_API block_t *aout_FiltersDrain(aout_filters_t *);
diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index e6ec3dd..1574436 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -288,6 +288,9 @@ static void aout_DecSynchronize (audio_output_t *aout, mtime_t dec_pts,
         drift = 0;
     }
 
+    if (!aout_FiltersCanResample(owner->filters))
+        return;
+
     /* Resampling */
     if (drift > +AOUT_MAX_PTS_DELAY
      && owner->sync.resamp_type != AOUT_RESAMPLING_UP)
diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index 020376f..175a8b0 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -548,6 +548,11 @@ void aout_FiltersDelete (vlc_object_t *obj, aout_filters_t *filters)
     free (filters);
 }
 
+bool aout_FiltersCanResample (aout_filters_t *filters)
+{
+    return (filters->resampler != NULL);
+}
+
 bool aout_FiltersAdjustResampling (aout_filters_t *filters, int adjust)
 {
     if (filters->resampler == NULL)
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 67a6744..4b6cdc2 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -27,6 +27,7 @@ aout_FiltersDelete
 aout_FiltersDrain
 aout_FiltersFlush
 aout_FiltersPlay
+aout_FiltersCanResample
 aout_FiltersAdjustResampling
 block_Alloc
 block_FifoCount
-- 
2.10.2



More information about the vlc-devel mailing list