Bug 1221228 - Work around busted OpenSL causing hangs/reboots on Android. r=padenot, a=sylvestre
authorJames Willcox <snorp@snorp.net>
Thu, 12 Nov 2015 14:52:42 -0600
changeset 284648 a8608fc16c09c13e018c6007b9d7c211872bd202
parent 284647 eaf685ae45f1650edcec546d6e0b3abae5bfd5e2
child 284649 687f98cac21223f633d2ecec2925ef3a4c17eab8
push id156
push usercbook@mozilla.com
push dateTue, 17 Nov 2015 07:53:15 +0000
reviewerspadenot, sylvestre
bugs1221228
milestone44.0a2
Bug 1221228 - Work around busted OpenSL causing hangs/reboots on Android. r=padenot, a=sylvestre
media/libcubeb/src/cubeb_opensl.c
--- a/media/libcubeb/src/cubeb_opensl.c
+++ b/media/libcubeb/src/cubeb_opensl.c
@@ -636,16 +636,19 @@ opensl_stream_init(cubeb * ctx, cubeb_st
   }
 
   res = (*stm->play)->RegisterCallback(stm->play, play_callback, stm);
   if (res != SL_RESULT_SUCCESS) {
     opensl_stream_destroy(stm);
     return CUBEB_ERROR;
   }
 
+  // Work around wilhelm/AudioTrack badness, bug 1221228
+  (*stm->play)->SetMarkerPosition(stm->play, (SLmillisecond)0);
+
   res = (*stm->play)->SetCallbackEventsMask(stm->play, (SLuint32)SL_PLAYEVENT_HEADATMARKER);
   if (res != SL_RESULT_SUCCESS) {
     opensl_stream_destroy(stm);
     return CUBEB_ERROR;
   }
 
   res = (*stm->bufq)->RegisterCallback(stm->bufq, bufferqueue_callback, stm);
   if (res != SL_RESULT_SUCCESS) {