[vlc-commits] auhal: always do a final format check in stream change function

David Fuhrmann git at videolan.org
Sat Mar 22 16:56:42 CET 2014


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sat Mar 22 14:06:20 2014 +0100| [2e4971051211f827340643f24ea8530331c40b05] | committer: David Fuhrmann

auhal: always do a final format check in stream change function

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

 modules/audio_output/auhal.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 891f9f7..fbe1c1e 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -1899,6 +1899,12 @@ static int AudioStreamChangeFormat(audio_output_t *p_aout, AudioStreamID i_strea
     UInt32 i_param_size = sizeof(AudioStreamBasicDescription);
     for (int i = 0; i < 5; i++) {
         /* Callback is not always invoked. So first check if format is already set. */
+        if (i > 0) {
+            mtime_t timeout = mdate() + 500000;
+            if (vlc_cond_timedwait(&w.cond, &w.lock, timeout))
+                msg_Dbg(p_aout, "reached timeout");
+        }
+
         err = AudioObjectGetPropertyData(i_stream_id, &physicalFormatAddress, 0, NULL, &i_param_size, &actual_format);
 
         msg_Dbg(p_aout, STREAM_FORMAT_MSG("actual format in use: ", actual_format));
@@ -1910,9 +1916,6 @@ static int AudioStreamChangeFormat(audio_output_t *p_aout, AudioStreamID i_strea
         }
 
         /* We need to check again */
-        mtime_t timeout = mdate() + 500000;
-        if (vlc_cond_timedwait(&w.cond, &w.lock, timeout))
-            msg_Dbg(p_aout, "reached timeout");
     }
 
 out:



More information about the vlc-commits mailing list