我正在使用带有树莓派的UV4L,用于将webrtc连接到Android设备。我在两者之间使用信令代理。进行webrtc通话时,音频可以正常工作,但视频几乎是黑屏,上面有一些绿色方块。
当我将Web客户端与使用同一代理的视频一起使用时,视频始终可以完美运行。
签名正确,并且数据按顺序发送和接收
1)转到设备-呼叫
2)转到应用-提供
3)TA-一对一的冰候选人
4)TD-回答
5)TD-安卓应用的冰人候选
在大多数情况下,我会收到带有绿色补丁的黑屏,但有时这种方法可行,并且我可以获得完整的视频。我尝试通过暂停接收视频并在一段时间后播放来延迟视频。在这种情况下,视频效果很好。但是我不知道为什么会这样。音频在两种方式上都可以正常工作。
PeerConnectionClient.kt
class PeerConnectionClient(private val activity: MainActivity, private val fSignalling: FSignalling) {
companion object {
private val rootEglBase by lazy {
EglBase.create()
}
private val mainConstraints: MediaConstraints by lazy {
val constraints = MediaConstraints()
constraints.mandatory.add(MediaConstraints.KeyValuePair("offerToReceiveAudio", "true"))
constraints.mandatory.add(MediaConstraints.KeyValuePair("offerToReceiveVideo", "true"))
constraints.optional.add(MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"))
constraints
}
private val myRTCConfig: PeerConnection.RTCConfiguration by lazy {
val rtcConfig = PeerConnection.RTCConfiguration(peerIceServers)
// TCP candidates are only useful when connecting to a server that supports
// ICE-TCP.
rtcConfig.enableDtlsSrtp = true
rtcConfig.enableRtpDataChannel = true
rtcConfig.bundlePolicy = PeerConnection.BundlePolicy.MAXBUNDLE
rtcConfig.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.REQUIRE
rtcConfig.continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY
// Use ECDSA encryption.
rtcConfig.keyType = PeerConnection.KeyType.ECDSA
rtcConfig
}
private val iceServersList = mutableListOf("stun:stun.l.google.com:19302")
private var peerIceServers: MutableList<PeerConnection.IceServer> = ArrayList()
}
internal var isConnected = false
internal var isEnabled = false
internal var isIced = false
internal var isVideoRunning = false
private val peerConnectionFactory: PeerConnectionFactory by lazy {
val initializationOptions = PeerConnectionFactory.InitializationOptions.builder(activity).createInitializationOptions()
PeerConnectionFactory.initialize(initializationOptions)
val options = PeerConnectionFactory.Options()
val defaultVideoEncoderFactory = DefaultVideoEncoderFactory(rootEglBase.eglBaseContext, true, true)
val defaultVideoDecoderFactory = DefaultVideoDecoderFactory(rootEglBase.eglBaseContext)
PeerConnectionFactory.builder()
.setOptions(options)
.setVideoEncoderFactory(defaultVideoEncoderFactory)
.setVideoDecoderFactory(defaultVideoDecoderFactory)
.createPeerConnectionFactory()
}
private var sdpConstraints: MediaConstraints? = null
private var localAudioTrack: AudioTrack? = null
private var localStream: MediaStream? = null
private var videoTrack: VideoTrack? = null
private var audioTrack: AudioTrack? = null
private var localPeer: PeerConnection? = null
private var gotUserMedia: Boolean = false
init {
peerIceServers.add(PeerConnection.IceServer.builder(iceServersList).createIceServer())
createPeer()
}
private fun createPeer() {
sdpConstraints = MediaConstraints()
val audioConstraints = MediaConstraints()
// add all existing audio filters to avoid having echos
audioConstraints.mandatory.add(MediaConstraints.KeyValuePair("googEchoCancellation", "true"))
audioConstraints.mandatory.add(MediaConstraints.KeyValuePair("googEchoCancellation2", "true"))
audioConstraints.mandatory.add(MediaConstraints.KeyValuePair("googDAEchoCancellation", "true"))
audioConstraints.mandatory.add(MediaConstraints.KeyValuePair("googTypingNoiseDetection", "true"))
// audioConstraints.mandatory.add(MediaConstraints.KeyValuePair("googAutoGainControl", "true"))
// audioConstraints.mandatory.add(MediaConstraints.KeyValuePair("googAutoGainControl2", "true"))
audioConstraints.mandatory.add(MediaConstraints.KeyValuePair("googNoiseSuppression", "true"))
audioConstraints.mandatory.add(MediaConstraints.KeyValuePair("googNoiseSuppression2", "true"))
audioConstraints.mandatory.add(MediaConstraints.KeyValuePair("googAudioMirroring", "false"))
audioConstraints.mandatory.add(MediaConstraints.KeyValuePair("googHighpassFilter", "true"))
val audioSource = peerConnectionFactory.createAudioSource(audioConstraints)
localAudioTrack = peerConnectionFactory.createAudioTrack("101", audioSource)
localAudioTrack?.setEnabled(false)
gotUserMedia = true
}
internal fun initPeer() {
activity.surface_view.init(rootEglBase.eglBaseContext, null)
activity.surface_view.setZOrderMediaOverlay(true)
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true)
WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(true)
WebRtcAudioUtils.setWebRtcBasedAutomaticGainControl(true)
// WebRtcAudioUtils.setDefaultSampleRateHz(22050)
activity.runOnUiThread {
if (localAudioTrack != null) {
createPeerConnection()
}
}
}
/**
* Creating the local peerconnection instance
*/
private fun createPeerConnection() {
localPeer = peerConnectionFactory.createPeerConnection(myRTCConfig, mainConstraints, object : PeerObserver {
override fun onIceCandidate(p0: IceCandidate) {
super.onIceCandidate(p0)
onIceCandidateReceived(p0)
}
override fun onAddStream(p0: MediaStream) {
activity.showToast("Received Remote stream")
super.onAddStream(p0)
gotRemoteStream(p0)
}
})
localStream = peerConnectionFactory.createLocalMediaStream("102")
localStream?.addTrack(localAudioTrack)
// localPeer!!.addStream(localStream)
}
private fun onIceCandidateReceived(iceCandidate: IceCandidate) {
//we have received ice candidate. We can set it to the other peer.
if (localPeer == null) {
return
}
val message = JSONObject()
message.put("type", "candidate")
message.put("label", iceCandidate.sdpMLineIndex)
message.put("id", iceCandidate.sdpMid)
message.put("candidate", iceCandidate.sdp) // iceCandidate.serverUrl)
fSignalling.doSignalingSend(message.toString())
}
private fun gotRemoteStream(stream: MediaStream) {
isConnected = true
//we have remote video stream. add to the renderer.
videoTrack = stream.videoTracks[0]
audioTrack = stream.audioTracks[0]
videoTrack?.setEnabled(false)
audioTrack?.setEnabled(false)
activity.runOnUiThread {
try {
videoTrack?.addSink(activity.surface_view)
} catch (e: Exception) {
e.printStackTrace()
}
}
enableAll()
}
internal fun enableAll() {
if (isConnected && isEnabled && isIced) {
Log.d("Peer Enable", "Enabling Peer")
localAudioTrack?.setEnabled(true)
videoTrack?.setEnabled(true)
audioTrack?.setEnabled(true)
isVideoRunning = true
}
}
internal fun disableAll() {
if (isConnected) {
localAudioTrack?.setEnabled(false)
videoTrack?.setEnabled(false)
audioTrack?.setEnabled(false)
}
isVideoRunning = false
}
fun onReceivePeerMessage(data: JSONObject) {
if (data.getString("type") == "offer") {
// val sdpReturned = SdpUtils.forceChosenVideoCodec(data.getString("sdp"), "H264")
val sdpReturned = data.getString("sdp")
// data.remove("sdp")
// data.put("sdp", sdpReturned)
val sessionDescription = SessionDescription(SessionDescription.Type.OFFER, sdpReturned)
localPeer?.setRemoteDescription(object: mySdpObserver {
override fun onSetSuccess() {
super.onSetSuccess()
localPeer?.addStream(localStream)
}
}, sessionDescription)
localPeer?.createAnswer(object : mySdpObserver {
override fun onCreateSuccess(p0: SessionDescription) {
super.onCreateSuccess(p0)
localPeer!!.setLocalDescription( object : mySdpObserver {}, p0)
val description = JSONObject()
description.put("type", p0.type.canonicalForm())
description.put("sdp", p0.description)
this@PeerConnectionClient.fSignalling.doSignalingSend(description.toString())
}
override fun onCreateFailure(p0: String) {
super.onCreateFailure(p0)
activity.showToast("Failed to create answer")
}
}, MediaConstraints())
} else if (data.getString("type") == "candidate") {
val iceCandidate = IceCandidate(data.getString("id"), data.getInt("label"), data.getString("candidate"))
localPeer?.addIceCandidate(iceCandidate)
if (iceCandidate.sdp == "") {
isIced = true
enableAll()
}
}
}
internal fun close() {
isConnected = false
isIced = false
localPeer?.close()
localPeer = null
}
}
视频不起作用时android中的错误消息:
2019-06-21 14:55:18.489 12310-12310/com.akshit.webrtcTest I/org.webrtc.Logging: EglRenderer: surface_viewInitializing EglRenderer
2019-06-21 14:55:18.491 12310-17205/com.akshit.webrtcTest I/org.webrtc.Logging: EglRenderer: surface_viewEglBase.create shared context
2019-06-21 14:55:18.491 12310-17205/com.akshit.webrtcTest I/org.webrtc.Logging: EglBase14: SDK version: 28. isEGL14Supported: true
2019-06-21 14:55:18.493 12310-12310/com.akshit.webrtcTest W/org.webrtc.Logging: WebRtcAudioUtils: setWebRtcBasedAutomaticGainControl() is deprecated
2019-06-21 14:55:18.522 12310-12310/com.akshit.webrtcTest I/org.webrtc.Logging: SurfaceViewRenderer: surface_view: onMeasure(). New size: 1440x1868
2019-06-21 14:55:18.523 12310-12310/com.akshit.webrtcTest I/org.webrtc.Logging: EglRenderer: surface_viewsetLayoutAspectRatio: 0.77087796
2019-06-21 14:55:20.495 12310-12382/com.akshit.webrtcTest I/org.webrtc.Logging: AndroidVideoDecoder: ctor name: OMX.qcom.video.decoder.vp8 type: VP8 color format: 19 context: org.webrtc.EglBase14$Context@52ec5d
2019-06-21 14:55:20.501 12310-12382/com.akshit.webrtcTest I/org.webrtc.Logging: AndroidVideoDecoder: ctor name: OMX.qcom.video.decoder.vp9 type: VP9 color format: 19 context: org.webrtc.EglBase14$Context@52ec5d
2019-06-21 14:55:20.506 12310-12382/com.akshit.webrtcTest I/org.webrtc.Logging: AndroidVideoDecoder: ctor name: OMX.qcom.video.decoder.avc type: H264 color format: 19 context: org.webrtc.EglBase14$Context@52ec5d
2019-06-21 14:55:20.510 12310-12382/com.akshit.webrtcTest I/org.webrtc.Logging: AndroidVideoDecoder: ctor name: OMX.google.h264.decoder type: H264 color format: 19 context: org.webrtc.EglBase14$Context@52ec5d
2019-06-21 14:55:20.519 12310-12382/com.akshit.webrtcTest D/OpenSLESPlayer: InitPlayout[tid=12382]
2019-06-21 14:55:20.519 12310-12382/com.akshit.webrtcTest D/OpenSLESPlayer: ObtainEngineInterface
2019-06-21 14:55:20.519 12310-12382/com.akshit.webrtcTest D/OpenSLESPlayer: CreateMix
2019-06-21 14:55:20.520 12310-12382/com.akshit.webrtcTest D/OpenSLESPlayer: StartPlayout[tid=12382]
2019-06-21 14:55:20.520 12310-12382/com.akshit.webrtcTest D/OpenSLESPlayer: CreateAudioPlayer
2019-06-21 14:55:20.521 12310-12382/com.akshit.webrtcTest I/libOpenSLES: Emulating old channel mask behavior (ignoring positional mask 0x4, using default mask 0x1 based on channel count of 1)
2019-06-21 14:55:20.522 12310-12382/com.akshit.webrtcTest W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 0 -> 1924
2019-06-21 14:55:20.536 12310-12382/com.akshit.webrtcTest I/org.webrtc.Logging: AndroidVideoDecoder: ctor name: OMX.qcom.video.decoder.avc type: H264 color format: 19 context: org.webrtc.EglBase14$Context@52ec5d
2019-06-21 14:55:20.538 12310-12382/com.akshit.webrtcTest I/org.webrtc.Logging: AndroidVideoDecoder: ctor name: OMX.google.h264.decoder type: H264 color format: 19 context: org.webrtc.EglBase14$Context@52ec5d
2019-06-21 14:55:20.539 12310-12382/com.akshit.webrtcTest D/OpenSLESRecorder: EnableBuiltInAEC(0)
2019-06-21 14:55:20.539 12310-12382/com.akshit.webrtcTest E/OpenSLESRecorder: Not implemented
2019-06-21 14:55:20.540 12310-12382/com.akshit.webrtcTest D/OpenSLESRecorder: EnableBuiltInNS(1)
2019-06-21 14:55:20.540 12310-12382/com.akshit.webrtcTest E/OpenSLESRecorder: Not implemented
2019-06-21 14:55:20.540 12310-12381/com.akshit.webrtcTest I/org.webrtc.Logging: NetworkMonitor: Start monitoring with native observer 495752937792
2019-06-21 14:55:20.556 12310-12355/com.akshit.webrtcTest I/org.webrtc.Logging: NetworkMonitorAutoDetect: Network becomes available: 156
2019-06-21 14:55:20.570 12310-12355/com.akshit.webrtcTest I/org.webrtc.Logging: NetworkMonitorAutoDetect: capabilities changed: [ Transports: WIFI Capabilities: NOT_METERED&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&VALIDATED&NOT_ROAMING&FOREGROUND&NOT_CONGESTED&NOT_SUSPENDED Unwanted: LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps SignalStrength: -65 SSID: "Whosonthedoor"]
2019-06-21 14:55:20.583 12310-12355/com.akshit.webrtcTest I/org.webrtc.Logging: NetworkMonitorAutoDetect: link properties changed: {InterfaceName: wlan0 LinkAddresses: [fe80::4a60:5fff:fe2e:4d9e/64,192.168.0.102/24,] Routes: [fe80::/64 -> :: wlan0,192.168.0.0/24 -> 0.0.0.0 wlan0,0.0.0.0/0 -> 192.168.0.1 wlan0,] DnsAddresses: [192.168.0.1,] UsePrivateDns: false PrivateDnsServerName: null Domains: null MTU: 0 TcpBufferSizes: 524288,2097152,8388608,262144,524288,4194304}
2019-06-21 14:55:20.916 12310-12310/com.akshit.webrtcTest D/Peer Enable: Enabling Peer
2019-06-21 14:55:21.247 12310-12382/com.akshit.webrtcTest D/OpenSLESRecorder: EnableBuiltInAEC(0)
2019-06-21 14:55:21.247 12310-12382/com.akshit.webrtcTest E/OpenSLESRecorder: Not implemented
2019-06-21 14:55:21.248 12310-12382/com.akshit.webrtcTest D/OpenSLESRecorder: EnableBuiltInNS(1)
2019-06-21 14:55:21.248 12310-12382/com.akshit.webrtcTest E/OpenSLESRecorder: Not implemented
2019-06-21 14:55:21.248 12310-12382/com.akshit.webrtcTest D/OpenSLESRecorder: InitRecording[tid=12382]
2019-06-21 14:55:21.248 12310-12382/com.akshit.webrtcTest D/OpenSLESRecorder: ObtainEngineInterface
2019-06-21 14:55:21.248 12310-12382/com.akshit.webrtcTest D/OpenSLESRecorder: CreateAudioRecorder
2019-06-21 14:55:21.248 12310-12382/com.akshit.webrtcTest D/OpenSLESRecorder: StartRecording[tid=12382]
2019-06-21 14:55:21.248 12310-12382/com.akshit.webrtcTest D/OpenSLESRecorder: state.count:2 state.index:0
2019-06-21 14:55:21.469 12310-17234/com.akshit.webrtcTest I/org.webrtc.Logging: EglBase14: SDK version: 28. isEGL14Supported: true
2019-06-21 14:55:21.475 12310-17234/com.akshit.webrtcTest I/org.webrtc.Logging: SurfaceTextureHelper: Setting listener to org.webrtc.AndroidVideoDecoder@1f45b6e
2019-06-21 14:55:21.475 12310-17217/com.akshit.webrtcTest I/org.webrtc.Logging: AndroidVideoDecoder: initDecodeInternal name: OMX.qcom.video.decoder.avc type: H264 width: 640 height: 480
2019-06-21 14:55:21.480 12310-17236/com.akshit.webrtcTest I/OMXClient: IOmx service obtained
2019-06-21 14:55:21.498 12310-17235/com.akshit.webrtcTest D/SurfaceUtils: connecting to surface 0x736c242010, reason connectToSurface
2019-06-21 14:55:21.498 12310-17235/com.akshit.webrtcTest I/MediaCodec: [OMX.qcom.video.decoder.avc] setting surface generation to 12605445
2019-06-21 14:55:21.498 12310-17235/com.akshit.webrtcTest D/SurfaceUtils: disconnecting from surface 0x736c242010, reason connectToSurface(reconnect)
2019-06-21 14:55:21.498 12310-17235/com.akshit.webrtcTest D/SurfaceUtils: connecting to surface 0x736c242010, reason connectToSurface(reconnect)
2019-06-21 14:55:21.515 12310-17236/com.akshit.webrtcTest D/SurfaceUtils: set up nativeWindow 0x736c242010 for 640x480, color 0x7fa30c06, rotation 0, usage 0x20002900
2019-06-21 14:55:21.523 12310-17217/com.akshit.webrtcTest I/org.webrtc.Logging: AndroidVideoDecoder: initDecodeInternal done
2019-06-21 14:55:21.523 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.526 12310-17236/com.akshit.webrtcTest I/chatty: uid=10223(com.akshit.webrtcTest) CodecLooper identical 1 line
2019-06-21 14:55:21.527 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.535 12310-17240/com.akshit.webrtcTest I/org.webrtc.Logging: AndroidVideoDecoder: Decoder format changed: {crop-right=639, color-format=2141391878, slice-height=480, mime=video/raw, hdr-static-info=java.nio.HeapByteBuffer[pos=0 lim=25 cap=25], stride=640, color-standard=4, color-transfer=3, crop-bottom=479, crop-left=0, width=640, color-range=2, crop-top=0, height=480}
2019-06-21 14:55:21.535 12310-17240/com.akshit.webrtcTest I/org.webrtc.Logging: AndroidVideoDecoder: Frame stride and slice height: 640 x 480
2019-06-21 14:55:21.537 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.538 12310-17216/com.akshit.webrtcTest I/org.webrtc.Logging: SurfaceEglRenderer: surface_view: Reporting first rendered frame.
2019-06-21 14:55:21.539 12310-17216/com.akshit.webrtcTest I/org.webrtc.Logging: SurfaceEglRenderer: surface_view: Reporting frame resolution changed to 640x480 with rotation 0
2019-06-21 14:55:21.552 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.563 12310-12310/com.akshit.webrtcTest I/org.webrtc.Logging: SurfaceViewRenderer: surface_view: onMeasure(). New size: 1440x2383
2019-06-21 14:55:21.571 12310-12310/com.akshit.webrtcTest I/org.webrtc.Logging: SurfaceViewRenderer: surface_view: onMeasure(). New size: 1440x1868
2019-06-21 14:55:21.582 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.583 12310-12310/com.akshit.webrtcTest I/org.webrtc.Logging: EglRenderer: surface_viewsetLayoutAspectRatio: 0.77087796
2019-06-21 14:55:21.590 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.641 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.677 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.712 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.746 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.783 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.812 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.844 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.881 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.914 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.949 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:21.981 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:22.015 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:22.510 12310-17205/com.akshit.webrtcTest I/org.webrtc.Logging: EglRenderer: surface_viewDuration: 4010 ms. Frames received: 2. Dropped: 0. Rendered: 2. Render fps: .5. Average render time: 5662 us. Average swapBuffer time: 2670 us.
2019-06-21 14:55:23.926 12310-17236/com.akshit.webrtcTest W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2019-06-21 14:55:26.518 12310-17205/com.akshit.webrtcTest I/org.webrtc.Logging: EglRenderer: surface_viewDuration: 4012 ms. Frames received: 1. Dropped: 0. Rendered: 1. Render fps: .2. Average render time: 6881 us. Average swapBuffer time: 5200 us.
2019-06-21 14:55:27.676 12310-12355/com.akshit.webrtcTest I/org.webrtc.Logging: NetworkMonitorAutoDetect: Network becomes available: 167
2019-06-21 14:55:27.685 12310-12355/com.akshit.webrtcTest I/org.webrtc.Logging: NetworkMonitorAutoDetect: capabilities changed: [ Transports: CELLULAR Capabilities: SUPL&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&NOT_ROAMING&FOREGROUND&NOT_CONGESTED&NOT_SUSPENDED Unwanted: LinkUpBandwidth>=51200Kbps LinkDnBandwidth>=102400Kbps Specifier: <1>]
2019-06-21 14:55:27.694 12310-12355/com.akshit.webrtcTest I/org.webrtc.Logging: NetworkMonitorAutoDetect: link properties changed: {InterfaceName: rmnet_data0 LinkAddresses: [25.70.239.124/29,] Routes: [0.0.0.0/0 -> 25.70.239.125 rmnet_data0,25.70.239.120/29 -> 0.0.0.0 rmnet_data0,] DnsAddresses: [49.45.0.1,] UsePrivateDns: false PrivateDnsServerName: null Domains: null MTU: 1500 TcpBufferSizes: 524288,1048576,8388608,262144,524288,4194304}
2019-06-21 14:55:28.296 12310-12355/com.akshit.webrtcTest I/org.webrtc.Logging: NetworkMonitorAutoDetect: link properties changed: {InterfaceName: rmnet_data0 LinkAddresses: [25.70.239.124/29,2405:204:8406:c337:b82b:bc48:9cfc:2e56/64,] Routes: [0.0.0.0/0 -> 25.70.239.125 rmnet_data0,::/0 -> fe80::d468:ec39:62d3:f326 rmnet_data0,25.70.239.120/29 -> 0.0.0.0 rmnet_data0,2405:204:8406:c337::/64 -> :: rmnet_data0,] DnsAddresses: [49.45.0.1,2405:200:800::1,] UsePrivateDns: false PrivateDnsServerName: null Domains: null MTU: 1500 TcpBufferSizes: 524288,1048576,8388608,262144,524288,4194304}
2019-06-21 14:55:30.528 12310-17205/com.akshit.webrtcTest I/org.webrtc.Logging: EglRenderer: surface_viewDuration: 4008 ms. Frames received: 12. Dropped: 0. Rendered: 12. Render fps: 3.0. Average render time: 5893 us. Average swapBuffer time: 3960 us.
2019-06-21 14:55:34.193 12310-12355/com.akshit.webrtcTest I/org.webrtc.Logging: NetworkMonitorAutoDetect: capabilities changed: [ Transports: CELLULAR Capabilities: SUPL&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&VALIDATED&NOT_ROAMING&FOREGROUND&NOT_CONGESTED&NOT_SUSPENDED Unwanted: LinkUpBandwidth>=51200Kbps LinkDnBandwidth>=102400Kbps Specifier: <1>]
2019-06-21 14:55:34.532 12310-17205/com.akshit.webrtcTest I/org.webrtc.Logging: EglRenderer: surface_viewDuration: 4005 ms. Frames received: 22. Dropped: 0. Rendered: 22. Render fps: 5.5. Average render time: 4742 us. Average swapBuffer time: 3293 us.
2019-06-21 14:55:36.887 12310-12382/com.akshit.webrtcTest D/OpenSLESRecorder: StopRecording[tid=12382]
2019-06-21 14:55:36.940 12310-12382/com.akshit.webrtcTest I/org.webrtc.Logging: AndroidVideoDecoder: release
2019-06-21 14:55:36.940 12310-17240/com.akshit.webrtcTest I/org.webrtc.Logging: AndroidVideoDecoder: Releasing MediaCodec on output thread
2019-06-21 14:55:36.948 12310-17235/com.akshit.webrtcTest D/SurfaceUtils: disconnecting from surface 0x736c242010, reason disconnectFromSurface
2019-06-21 14:55:36.959 12310-17240/com.akshit.webrtcTest I/org.webrtc.Logging: AndroidVideoDecoder: Release on output thread done
2019-06-21 14:55:36.959 12310-12382/com.akshit.webrtcTest I/org.webrtc.Logging: SurfaceTextureHelper: stopListening()
2019-06-21 14:55:36.960 12310-12382/com.akshit.webrtcTest I/org.webrtc.Logging: SurfaceTextureHelper: dispose()
2019-06-21 14:55:36.963 12310-12382/com.akshit.webrtcTest D/OpenSLESPlayer: StopPlayout[tid=12382]
2019-06-21 14:55:36.963 12310-12382/com.akshit.webrtcTest D/AudioTrack: stop() called with 791040 frames delivered
2019-06-21 14:55:36.964 12310-12382/com.akshit.webrtcTest D/OpenSLESPlayer: DestroyAudioPlayer
2019-06-21 14:55:36.967 12310-12381/com.akshit.webrtcTest I/org.webrtc.Logging: NetworkMonitor: Stop monitoring with native observer 495752937792
2019-06-21 14:55:36.967 12310-12381/com.akshit.webrtcTest I/org.webrtc.Logging: NetworkMonitorAutoDetect: Unregister network callback
2019-06-21 14:55:36.968 12310-12381/com.akshit.webrtcTest I/org.webrtc.Logging: NetworkMonitorAutoDetect: Unregister network callback
2019-06-21 14:55:36.976 12310-17205/com.akshit.webrtcTest I/org.webrtc.Logging: EglRenderer: surface_viewclearSurface
2019-06-21 14:55:36.976 12310-12310/com.akshit.webrtcTest I/org.webrtc.Logging: EglRenderer: surface_viewReleasing.
2019-06-21 14:55:36.979 12310-17205/com.akshit.webrtcTest I/org.webrtc.Logging: GlShader: Deleting shader.
2019-06-21 14:55:36.980 12310-17205/com.akshit.webrtcTest I/org.webrtc.Logging: EglRenderer: surface_vieweglBase detach and release.
2019-06-21 14:55:36.983 12310-12310/com.akshit.webrtcTest I/org.webrtc.Logging: EglRenderer: surface_viewReleasing done.
2019-06-21 14:55:36.983 12310-17205/com.akshit.webrtcTest I/org.webrtc.Logging: EglRenderer: surface_viewQuitting render thread.
答案 0 :(得分:0)
将编码更改为VP9可使一切正常。我猜想硬件解码在android webrtc库中是不正确的。
答案 1 :(得分:0)
这可能是由于解码器需要从h264 I-Frame预测解码器, 在UV4L中,可以通过更改--webrtc-hw-vcodec-intra-period设置较小的内部周期