1. PeerConnectionClient.java
設置在如下接口:
private void createPeerConnectionInternal(Context context,EglBase.Context renderEGLContext) { rtcConfig.audioJitterBufferMaxPackets = 30; //設置jitter buffter大小爲30 }
2. PeerConnection.java文件
public RTCConfiguration(List<IceServer> iceServers) { iceTransportsType = IceTransportsType.ALL; bundlePolicy = BundlePolicy.BALANCED; rtcpMuxPolicy = RtcpMuxPolicy.REQUIRE; tcpCandidatePolicy = TcpCandidatePolicy.ENABLED; candidateNetworkPolicy = candidateNetworkPolicy.ALL; this.iceServers = iceServers; audioJitterBufferMaxPackets = 50; audioJitterBufferFastAccelerate = false; iceConnectionReceivingTimeout = -1; iceBackupCandidatePairPingInterval = -1; keyType = KeyType.ECDSA; continualGatheringPolicy = ContinualGatheringPolicy.GATHER_ONCE; iceCandidatePoolSize = 0; pruneTurnPorts = false; presumeWritableWhenFullyRelayed = false; iceCheckMinInterval = null; disableIPv6OnWifi = false; } };
參數爲audioJitterBufferMaxPackets
2. webrtc源碼限制最小隻能爲20
webrtcvoiceengine.cc
bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in){ if (options.audio_jitter_buffer_max_packets) { channel_config_.acm_config.neteq_config.max_packets_in_buffer = std::max(20, *options.audio_jitter_buffer_max_packets); } }
以上就是webrtc jitter buffer大小設置