[vlc-commits] audiotrack: Add a define to fetch or not native sample rate

Thomas Guillem git at videolan.org
Wed Apr 29 14:11:10 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Apr 29 10:17:10 2015 +0200| [1f02594b331d532df0c394454393aeaf144f999b] | committer: Thomas Guillem

audiotrack: Add a define to fetch or not native sample rate

If activated, most of  the resampling  will be done by VLC.

Deactivated for now since android resampler is better than the ugly resampler.

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

 modules/audio_output/audiotrack.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/audio_output/audiotrack.c b/modules/audio_output/audiotrack.c
index 0347aee..12fc84a 100644
--- a/modules/audio_output/audiotrack.c
+++ b/modules/audio_output/audiotrack.c
@@ -108,6 +108,10 @@ struct aout_sys_t {
 //#define AUDIOTRACK_USE_FLOAT
 //#define AUDIOTRACK_HW_LATENCY
 
+/* Get AudioTrack native sample rate: if activated, most of  the resampling
+ * will be done by VLC */
+//#define AUDIOTRACK_NATIVE_SAMPLERATE
+
 #define AUDIO_CHAN_TEXT N_("Audio output channels")
 #define AUDIO_CHAN_LONGTEXT N_("Channels available for audio output. " \
     "If the input has more channels than the output, it will be down-mixed. " \
@@ -279,8 +283,10 @@ InitJNIFields( audio_output_t *p_aout )
 
     GET_ID( GetStaticMethodID, AudioTrack.getMinBufferSize, "getMinBufferSize",
             "(III)I", true );
+#ifdef AUDIOTRACK_NATIVE_SAMPLERATE
     GET_ID( GetStaticMethodID, AudioTrack.getNativeOutputSampleRate,
             "getNativeOutputSampleRate",  "(I)I", true );
+#endif
     GET_CONST_INT( AudioTrack.STATE_INITIALIZED, "STATE_INITIALIZED", true );
     GET_CONST_INT( AudioTrack.MODE_STREAM, "MODE_STREAM", true );
     GET_CONST_INT( AudioTrack.ERROR, "ERROR", true );
@@ -831,7 +837,7 @@ Start( audio_output_t *p_aout, audio_sample_format_t *restrict p_fmt )
     JNIEnv *env;
     jobject p_audiotrack = NULL;
     int i_nb_channels, i_max_channels, i_audiotrack_size, i_bytes_per_frame,
-        i_native_rate;
+        i_native_rate = 0;
     unsigned int i_rate;
     bool b_spdif;
 
@@ -853,13 +859,11 @@ Start( audio_output_t *p_aout, audio_sample_format_t *restrict p_fmt )
     }
     else
     {
-        i_native_rate = JNI_AT_CALL_STATIC_INT( getNativeOutputSampleRate,
-                                                jfields.AudioManager.STREAM_MUSIC );
+        if (jfields.AudioTrack.getNativeOutputSampleRate)
+            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