Java Code Examples for org.webrtc.voiceengine.WebRtcAudioManager#setBlacklistDeviceForOpenSLESUsage()
The following examples show how to use
org.webrtc.voiceengine.WebRtcAudioManager#setBlacklistDeviceForOpenSLESUsage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApplicationContext.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
private void initializeRingRtc() { try { Set<String> HARDWARE_AEC_BLACKLIST = new HashSet<String>() {{ add("Pixel"); add("Pixel XL"); add("Moto G5"); add("Moto G (5S) Plus"); add("Moto G4"); add("TA-1053"); add("Mi A1"); add("Mi A2"); add("E5823"); // Sony z5 compact add("Redmi Note 5"); add("FP2"); // Fairphone FP2 add("MI 5"); }}; Set<String> OPEN_SL_ES_WHITELIST = new HashSet<String>() {{ add("Pixel"); add("Pixel XL"); }}; if (HARDWARE_AEC_BLACKLIST.contains(Build.MODEL)) { WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true); } if (!OPEN_SL_ES_WHITELIST.contains(Build.MODEL)) { WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true); } CallManager.initialize(this, new RingRtcLogger()); } catch (UnsatisfiedLinkError e) { throw new AssertionError("Unable to load ringrtc library", e); } }
Example 2
Source File: WebRTC.java From iGap-Android with GNU Affero General Public License v3.0 | 5 votes |
/** * First, we initiate the PeerConnectionFactory with our application context and some options. */ private PeerConnectionFactory peerConnectionFactoryInstance() { if (peerConnectionFactory == null) { Set<String> HARDWARE_AEC_WHITELIST = new HashSet<String>() {{ add("D5803"); add("FP1"); add("SM-A500FU"); add("XT1092"); }}; Set<String> OPEN_SL_ES_WHITELIST = new HashSet<String>() {{ }}; if (Build.VERSION.SDK_INT >= 11) { if (HARDWARE_AEC_WHITELIST.contains(Build.MODEL)) { WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(false); } else { WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true); } if (OPEN_SL_ES_WHITELIST.contains(Build.MODEL)) { WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(false); } else { WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true); } } PeerConnectionFactory.initialize(PeerConnectionFactory.InitializationOptions.builder(G.context).createInitializationOptions()); peerConnectionFactory = PeerConnectionFactory.builder().createPeerConnectionFactory(); } return peerConnectionFactory; }
Example 3
Source File: PeerConnectionClient.java From janus-gateway-android with MIT License | 4 votes |
private void createPeerConnectionFactoryInternal(Context context) { PeerConnectionFactory.initializeInternalTracer(); if (peerConnectionParameters.tracing) { PeerConnectionFactory.startInternalTracingCapture( Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "webrtc-trace.txt"); } Log.d(TAG, "Create peer connection factory. Use video: true"); isError = false; // Initialize field trials. PeerConnectionFactory.initializeFieldTrials(""); // Check preferred video codec. preferredVideoCodec = VIDEO_CODEC_VP8; if (peerConnectionParameters.videoCodec != null) { if (peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_VP9)) { preferredVideoCodec = VIDEO_CODEC_VP9; } else if (peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_H264)) { preferredVideoCodec = VIDEO_CODEC_H264; } } Log.d(TAG, "Pereferred video codec: " + preferredVideoCodec); // Enable/disable OpenSL ES playback. if (!peerConnectionParameters.useOpenSLES) { Log.d(TAG, "Disable OpenSL ES audio even if device supports it"); WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true /* enable */); } else { Log.d(TAG, "Allow OpenSL ES audio if device supports it"); WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(false); } if (peerConnectionParameters.disableBuiltInAEC) { Log.d(TAG, "Disable built-in AEC even if device supports it"); WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true); } else { Log.d(TAG, "Enable built-in AEC if device supports it"); WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(false); } if (peerConnectionParameters.disableBuiltInAGC) { Log.d(TAG, "Disable built-in AGC even if device supports it"); WebRtcAudioUtils.setWebRtcBasedAutomaticGainControl(true); } else { Log.d(TAG, "Enable built-in AGC if device supports it"); WebRtcAudioUtils.setWebRtcBasedAutomaticGainControl(false); } if (peerConnectionParameters.disableBuiltInNS) { Log.d(TAG, "Disable built-in NS even if device supports it"); WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(true); } else { Log.d(TAG, "Enable built-in NS if device supports it"); WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(false); } // Create peer connection factory. if (!PeerConnectionFactory.initializeAndroidGlobals( context, true, true, peerConnectionParameters.videoCodecHwAcceleration)) { events.onPeerConnectionError("Failed to initializeAndroidGlobals"); } if (options != null) { Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMask); } this.context = context; factory = new PeerConnectionFactory(options); Log.d(TAG, "Peer connection factory created."); }
Example 4
Source File: CustomTwilioVideoView.java From react-native-twilio-video-webrtc with MIT License | 4 votes |
public void disableOpenSLES() { WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true); }
Example 5
Source File: PeerConnectionClient.java From Yahala-Messenger with MIT License | 4 votes |
private void createPeerConnectionFactoryInternal(Context context) { PeerConnectionFactory.printStackTraces(); if (peerConnectionParameters.tracing) { PeerConnectionFactory.initializeFieldTrials("/mnt/sdcard/webrtc-trace.txt"); } Log.d(TAG, "Create peer connection factory. Use video: " + peerConnectionParameters.videoCallEnabled); isError = false; // Initialize field trials. PeerConnectionFactory.initializeFieldTrials(FIELD_TRIAL_AUTOMATIC_RESIZE); // Check preferred video codec. preferredVideoCodec = VIDEO_CODEC_VP8; if (videoCallEnabled && peerConnectionParameters.videoCodec != null) { if (peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_VP9)) { preferredVideoCodec = VIDEO_CODEC_VP9; } else if (peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_H264)) { preferredVideoCodec = VIDEO_CODEC_H264; } } Log.d(TAG, "Pereferred video codec: " + preferredVideoCodec); // Check if ISAC is used by default. preferIsac = false; if (peerConnectionParameters.audioCodec != null && peerConnectionParameters.audioCodec.equals(AUDIO_CODEC_ISAC)) { preferIsac = true; } // Enable/disable OpenSL ES playback. if (!peerConnectionParameters.useOpenSLES) { Log.d(TAG, "Disable OpenSL ES audio even if device supports it"); WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true /* enable */); } else { Log.d(TAG, "Allow OpenSL ES audio if device supports it"); WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(false); } // Create peer connection factory. if (!PeerConnectionFactory.initializeAndroidGlobals(context, true, true, peerConnectionParameters.videoCodecHwAcceleration)) { events.onPeerConnectionError("Failed to initializeAndroidGlobals"); } factory = new PeerConnectionFactory(); if (options != null) { Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMask); factory.setOptions(options); } Log.d(TAG, "Peer connection factory created."); }