Chromium Code Reviews| Index: webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java |
| diff --git a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java |
| index 3e003294aac346827c2092c2698c6f97aaed7ff2..bee50af93ac2a1e705e17d336ef3c28256eef052 100644 |
| --- a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java |
| +++ b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java |
| @@ -184,12 +184,22 @@ public class WebRtcAudioTrack { |
| AudioFormat.CHANNEL_OUT_MONO, |
| AudioFormat.ENCODING_PCM_16BIT); |
| Logging.d(TAG, "AudioTrack.getMinBufferSize: " + minBufferSizeInBytes); |
| - assertTrue(audioTrack == null); |
| - |
| // For the streaming mode, data must be written to the audio sink in |
| // chunks of size (given by byteBuffer.capacity()) less than or equal |
| - // to the total buffer size |minBufferSizeInBytes|. |
| - assertTrue(byteBuffer.capacity() < minBufferSizeInBytes); |
| + // to the total buffer size |minBufferSizeInBytes|. But, we have seen |
| + // reports of "getMinBufferSize(): error querying hardware". Hence, it |
| + // can happen that |minBufferSizeInBytes| contains an invalid value. |
| + if (byteBuffer.capacity() < minBufferSizeInBytes) { |
| + Logging.e(TAG, "AudioTrack.getMinBufferSize returns an invalid value."); |
|
magjed_webrtc
2016/09/08 09:45:21
nit: Maybe it would be nice to log this invalid va
henrika_webrtc
2016/09/08 09:46:52
But is is always logged above on line 186. OK?
magjed_webrtc
2016/09/08 09:48:18
OK.
|
| + return false; |
| + } |
| + |
| + // Ensure that prevision audio session was stopped correctly before trying |
| + // to create a new AudioTrack. |
| + if (audioTrack != null) { |
| + Logging.e(TAG, "Conflict with existing AudioTrack."); |
| + return false; |
| + } |
| try { |
| // Create an AudioTrack object and initialize its associated audio buffer. |
| // The size of this buffer determines how long an AudioTrack can play |