[vlc-commits] opensles: resample if original sampling rate is not accepted

Rafaël Carré git at videolan.org
Mon Jun 24 05:11:30 CEST 2013


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Mon Jun 24 05:10:48 2013 +0200| [c599784400b1bae5294f42741dea3b002ce5ae5b] | committer: Rafaël Carré

opensles: resample if original sampling rate is not accepted

Close: #8638

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

 modules/audio_output/opensles_android.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/audio_output/opensles_android.c b/modules/audio_output/opensles_android.c
index 0f509e6..9c80495 100644
--- a/modules/audio_output/opensles_android.c
+++ b/modules/audio_output/opensles_android.c
@@ -388,6 +388,14 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
     result = CreateAudioPlayer(sys->engineEngine, &sys->playerObject, &audioSrc,
                                     &audioSnk, sizeof(ids2) / sizeof(*ids2),
                                     ids2, req2);
+    if (unlikely(result != SL_RESULT_SUCCESS)) {
+        /* Try again with a more sensible samplerate */
+        fmt->i_rate = 44100;
+        format_pcm.samplesPerSec = ((SLuint32) 44100 * 1000) ;
+        result = CreateAudioPlayer(sys->engineEngine, &sys->playerObject, &audioSrc,
+                &audioSnk, sizeof(ids2) / sizeof(*ids2),
+                ids2, req2);
+    }
     CHECK_OPENSL_ERROR("Failed to create audio player");
 
     result = Realize(sys->playerObject, SL_BOOLEAN_FALSE);



More information about the vlc-commits mailing list