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

Julian Scheel git at videolan.org
Wed Dec 28 09:15:40 CET 2016


vlc | branch: master | Julian Scheel <julian at jusst.de> | Wed Dec 28 09:01:03 2016 +0100| [846fb7c2f2d14c118dae21e817c948cab5ce68a2] | committer: Thomas Guillem

aout: Do not try to resample without filter

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: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=846fb7c2f2d14c118dae21e817c948cab5ce68a2
---

 src/audio_output/aout_internal.h | 3 +++
 src/audio_output/dec.c           | 3 +++
 src/audio_output/filters.c       | 5 +++++
 3 files changed, 11 insertions(+)

diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index c6edf8e..8516d4c 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -152,4 +152,7 @@ static inline void aout_InputRequestRestart(audio_output_t *aout)
     aout_RequestRestart(aout, AOUT_RESTART_FILTERS);
 }
 
+/* From filters.c */
+bool aout_FiltersCanResample (aout_filters_t *filters);
+
 #endif /* !LIBVLC_AOUT_INTERNAL_H */
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)



More information about the vlc-commits mailing list