[vlc-commits] audio_output: aout_DecPlay: signal if the aout changed or failed

Thomas Guillem git at videolan.org
Thu Jul 28 09:04:35 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jul 27 17:08:30 2016 +0200| [594d5b26275a88237b23e7d837ef3e9cc57c843a] | committer: Thomas Guillem

audio_output: aout_DecPlay: signal if the aout changed or failed

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

 src/audio_output/aout_internal.h |  6 +++++-
 src/audio_output/dec.c           | 11 +++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index 4990597..c6edf8e 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -134,10 +134,14 @@ bool aout_ChangeFilterString( vlc_object_t *manager, vlc_object_t *aout,
                               const char *var, const char *name, bool b_add );
 
 /* From dec.c */
+#define AOUT_DEC_SUCCESS 0
+#define AOUT_DEC_CHANGED 1
+#define AOUT_DEC_FAILED VLC_EGENERIC
+
 int aout_DecNew(audio_output_t *, const audio_sample_format_t *,
                 const audio_replay_gain_t *, const aout_request_vout_t *);
 void aout_DecDelete(audio_output_t *);
-void aout_DecPlay(audio_output_t *, block_t *, int i_input_rate);
+int aout_DecPlay(audio_output_t *, block_t *, int i_input_rate);
 void aout_DecGetResetStats(audio_output_t *, unsigned *, unsigned *);
 void aout_DecChangePause(audio_output_t *, bool b_paused, mtime_t i_date);
 void aout_DecFlush(audio_output_t *, bool wait);
diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index 84c2f60..c1cc1db 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -135,6 +135,7 @@ static int aout_CheckReady (audio_output_t *aout)
 {
     aout_owner_t *owner = aout_owner (aout);
 
+    int status = AOUT_DEC_SUCCESS;
     int restart = atomic_exchange (&owner->restart, 0);
     if (unlikely(restart))
     {
@@ -151,6 +152,7 @@ static int aout_CheckReady (audio_output_t *aout)
                 owner->mixer_format.i_format = 0;
             aout_volume_SetFormat (owner->volume,
                                    owner->mixer_format.i_format);
+            status = AOUT_DEC_CHANGED;
         }
 
         msg_Dbg (aout, "restarting filters...");
@@ -172,7 +174,7 @@ static int aout_CheckReady (audio_output_t *aout)
          * left over by an audio visualization:
         input_resource_TerminatVout(MAGIC HERE); */
     }
-    return (owner->mixer_format.i_format) ? 0 : -1;
+    return (owner->mixer_format.i_format) ? status : AOUT_DEC_FAILED;
 }
 
 /**
@@ -339,7 +341,7 @@ static void aout_DecSynchronize (audio_output_t *aout, mtime_t dec_pts,
 /*****************************************************************************
  * aout_DecPlay : filter & mix the decoded buffer
  *****************************************************************************/
-void aout_DecPlay (audio_output_t *aout, block_t *block, int input_rate)
+int aout_DecPlay (audio_output_t *aout, block_t *block, int input_rate)
 {
     aout_owner_t *owner = aout_owner (aout);
 
@@ -351,7 +353,8 @@ void aout_DecPlay (audio_output_t *aout, block_t *block, int input_rate)
                                  / owner->input_format.i_rate;
 
     aout_OutputLock (aout);
-    if (unlikely(aout_CheckReady (aout)))
+    int ret = aout_CheckReady (aout);
+    if (unlikely(ret == AOUT_DEC_FAILED))
         goto drop; /* Pipeline is unrecoverably broken :-( */
 
     const mtime_t now = mdate (), advance = block->i_pts - now;
@@ -388,7 +391,7 @@ void aout_DecPlay (audio_output_t *aout, block_t *block, int input_rate)
     atomic_fetch_add(&owner->buffers_played, 1);
 out:
     aout_OutputUnlock (aout);
-    return;
+    return ret;
 drop:
     owner->sync.discontinuity = true;
     block_Release (block);



More information about the vlc-commits mailing list