Bug 804387 - Part 0: Handle the possible Java exception in AudioTrack.stop() while destroying an audio stream; r=snorp
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 05 Feb 2013 10:29:24 -0500
changeset 130762 b1533f8a8e128f80a683fab54c31133e35b890b3
parent 130761 77e05f6dc00745446745a400fe63f524d362b92a
child 130763 5a403ead198d2c57109acbb42288cfa77b07eaa6
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs804387
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 804387 - Part 0: Handle the possible Java exception in AudioTrack.stop() while destroying an audio stream; r=snorp
media/libsydneyaudio/src/sydney_audio_android.c
--- a/media/libsydneyaudio/src/sydney_audio_android.c
+++ b/media/libsydneyaudio/src/sydney_audio_android.c
@@ -264,16 +264,24 @@ sa_stream_destroy(sa_stream_t *s) {
     return SA_SUCCESS;
   }
 
   if (s->output_buf) {
     (*jenv)->DeleteGlobalRef(jenv, s->output_buf);
   }
   if (s->output_unit) {
     (*jenv)->CallVoidMethod(jenv, s->output_unit, at.stop);
+
+    jthrowable exception = (*jenv)->ExceptionOccurred(jenv);
+    if (exception) {
+      (*jenv)->ExceptionDescribe(jenv);
+      (*jenv)->ExceptionClear(jenv);
+      return SA_ERROR_INVALID;
+    }
+
     (*jenv)->CallVoidMethod(jenv, s->output_unit, at.flush);
     (*jenv)->CallVoidMethod(jenv, s->output_unit, at.release);
     (*jenv)->DeleteGlobalRef(jenv, s->output_unit);
   }
   if (s->at_class) {
     (*jenv)->DeleteGlobalRef(jenv, s->at_class);
   }
   free(s);