audio record: fix getPortId() after release
Some race condition can cause AudioRecordingMonitorImpl to call getPortId() on the client object after it has been released causing an exception to be thrown by the JNI. Test: Use audio Recorder app and check that no exception is thrown when recording stops Change-Id: I6cc1aee0a2ccae879e2cb5df7af757f33436d1f3
This commit is contained in:
@@ -1788,6 +1788,9 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection,
|
||||
* @hide
|
||||
*/
|
||||
public int getPortId() {
|
||||
if (mNativeRecorderInJavaObj == 0) {
|
||||
return 0;
|
||||
}
|
||||
return native_getPortId();
|
||||
}
|
||||
|
||||
|
||||
@@ -1624,6 +1624,9 @@ public class MediaRecorder implements AudioRouting,
|
||||
* @hide
|
||||
*/
|
||||
public int getPortId() {
|
||||
if (mNativeContext == 0) {
|
||||
return 0;
|
||||
}
|
||||
return native_getPortId();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user