[vlc-commits] audiotrack: use input sample rate when using spdif

Thomas Guillem git at videolan.org
Mon Apr 20 10:18:52 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Apr 20 10:15:29 2015 +0200| [6006bd36562ad4565f5978f45c6e23b3792a4728] | committer: Thomas Guillem

audiotrack: use input sample rate when using spdif

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

 modules/audio_output/audiotrack.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/modules/audio_output/audiotrack.c b/modules/audio_output/audiotrack.c
index 450a90c..0347aee 100644
--- a/modules/audio_output/audiotrack.c
+++ b/modules/audio_output/audiotrack.c
@@ -847,12 +847,19 @@ Start( audio_output_t *p_aout, audio_sample_format_t *restrict p_fmt )
 
     p_sys->fmt.i_original_channels = p_sys->fmt.i_physical_channels;
 
-    i_native_rate = JNI_AT_CALL_STATIC_INT( getNativeOutputSampleRate,
-                                            jfields.AudioManager.STREAM_MUSIC );
-    if( i_native_rate <= 0 )
+    if( b_spdif )
     {
-        msg_Warn( p_aout, "negative native rate ? Should not happen !" );
-        i_native_rate = VLC_CLIP( p_sys->fmt.i_rate, 4000, 48000 );
+        i_native_rate = p_sys->fmt.i_rate;
+    }
+    else
+    {
+        i_native_rate = JNI_AT_CALL_STATIC_INT( getNativeOutputSampleRate,
+                                                jfields.AudioManager.STREAM_MUSIC );
+        if( i_native_rate <= 0 )
+        {
+            msg_Warn( p_aout, "negative native rate ? Should not happen !" );
+            i_native_rate = VLC_CLIP( p_sys->fmt.i_rate, 4000, 48000 );
+        }
     }
 
     /* We can only accept U8, S16N, FL32, and AC3 */



More information about the vlc-commits mailing list