Jump to content
  • 0

webrtc native client issue


Rafal Kulczycki
 Share

Question

I'm using native c++ API to build client app to connect to AMS and stream (play) published audio and video content.  I hit a snag where signaling completes successfully but then server responds with "play_finished" message.  The logs on the server show the following:

  headerBytesReceived: 16365160, packetsLost: 0, lastPacketReceivedTimestamp: 1251411.101, jitter: 0.002 }
2021-01-20 19:58:34,334 [network_thread - 28582] INFO i.a.e.adaptive.WebRTCEncoderAdaptor - Publish Stats StreamId: raf TransferedByte: 717836549 Stream Duration: 11689537 Bitrate: 61 Source IP: x.x.x.x 47 User-Agent: N/A

2021-01-20 19:58:38,105 [vert.x-eventloop-thread-1] WARN i.a.enterprise.webrtc.WebRTCClient - It's still not streaming so stop the webrtc client for stream: raf and client:988791721

2021-01-20 19:58:38,106 [vert.x-eventloop-thread-0] INFO i.a.enterprise.webrtc.WebRTCClient - Stop is called for raf for 988791721

2021-01-20 19:58:38,106 [vert.x-eventloop-thread-0] INFO i.a.enterprise.webrtc.WebRTCClient - Disposing audio source for stream Id raf

What am I missing on the client side to cause this message?

Thanks,
Link to comment
Share on other sites

  • Answers 4
  • Created
  • Last Reply

Top Posters For This Question

4 answers to this question

Recommended Posts

  • 0

Hi Selime,

Below is the log you requested, it looks like my peerconnection is only gathering a single host IceCandidate which I'm forwarding to AMS, is this the problem even though my client is not publishing any streams? My code is not a opens source so I don't have a repo that I can share with you right now.

start publishing stream:
2021-01-22 15:32:23,210 [https-jsse-nio-0.0.0.0-5443-exec-2] INFO  i.a.e.s.WebSocketLocalHandler - Web Socket opened
2021-01-22 15:32:44,873 [https-jsse-nio-0.0.0.0-5443-exec-7] INFO  i.a.e.w.WebSocketEnterpriseHandler - received token:null
2021-01-22 15:32:44,874 [https-jsse-nio-0.0.0.0-5443-exec-7] INFO  i.a.e.w.c.VirtualVideoEncoderFactory - Adding H264 Encoder to the supported codecs
2021-01-22 15:32:44,896 [https-jsse-nio-0.0.0.0-5443-exec-7] INFO  i.a.e.w.WebSocketEnterpriseHandler - Adding new stream raf to session ff
2021-01-22 15:32:44,897 [https-jsse-nio-0.0.0.0-5443-exec-7] INFO  i.a.e.adaptive.EncoderAdaptor - ServerSettings exist io.antmedia.settings.ServerSettings@6ae99216
2021-01-22 15:32:44,961 [https-jsse-nio-0.0.0.0-5443-exec-8] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - before prepare for raf hash: 1818084678
2021-01-22 15:32:44,962 [https-jsse-nio-0.0.0.0-5443-exec-8] INFO  io.antmedia.muxer.HLSMuxer - hls time: 2, hls list size: 5
2021-01-22 15:32:44,963 [https-jsse-nio-0.0.0.0-5443-exec-8] INFO  i.a.e.adaptive.StreamAdaptor - Stream adaptor scheduled job id 196 stream adaptor:557137761 for stream:raf
2021-01-22 15:32:44,963 [https-jsse-nio-0.0.0.0-5443-exec-8] INFO  i.a.enterprise.adaptive.AACEncoder - name : aac
2021-01-22 15:32:44,965 [https-jsse-nio-0.0.0.0-5443-exec-8] INFO  io.antmedia.muxer.HLSMuxer - copy codec parameter from context 0 stream index: 0
2021-01-22 15:32:44,965 [https-jsse-nio-0.0.0.0-5443-exec-8] INFO  i.a.enterprise.adaptive.OpusEncoder - encoder name libopus source sample rate 44100, channel layout 3
2021-01-22 15:32:44,966 [https-jsse-nio-0.0.0.0-5443-exec-8] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - after prepare for raf hash:1818084678
2021-01-22 15:32:44,966 [vert.x-eventloop-thread-2] INFO  org.webrtc.Logging - Tag:NativeLibrary - Message:Native library has already been loaded.
2021-01-22 15:32:44,967 [vert.x-eventloop-thread-2] INFO  org.webrtc.Logging - Tag:PeerConnectionFactory - Message:PeerConnectionFactory was initialized without an injected Loggable. Any existing Loggable will be deleted.
2021-01-22 15:32:44,967 [vert.x-eventloop-thread-2] INFO  org.webrtc.Logging - Tag:JavaAudioDeviceModule - Message:createAudioDeviceModule
2021-01-22 15:32:44,967 [vert.x-eventloop-thread-2] INFO  org.webrtc.Logging - Tag:JavaAudioDeviceModule - Message:HW NS will not be used.
2021-01-22 15:32:44,967 [vert.x-eventloop-thread-2] INFO  org.webrtc.Logging - Tag:JavaAudioDeviceModule - Message:HW AEC will not be used.
2021-01-22 15:32:44,975 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCVideoForwarder - create decoder for name:H264 and params: {level-asymmetry-allowed=1, packetization-mode=1, profile-level-id=42e01f}
2021-01-22 15:32:44,976 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - onAddTrack for streamId raf
2021-01-22 15:32:44,977 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - onAddTrack for streamId raf
2021-01-22 15:32:44,977 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCVideoForwarder - onAddStream for streamId raf
2021-01-22 15:32:44,977 [vert.x-eventloop-thread-2] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - onSetSuccess signalling thread for raf ice candidate queue size: 0
2021-01-22 15:32:44,980 [network_thread - 3287] INFO  org.webrtc.Logging - Tag:WebRtcAudioTrackExternal - Message:initPlayout(sampleRate=16000, channels=1, bufferSizeFactor=1.0)
2021-01-22 15:32:44,980 [network_thread - 3287] INFO  org.webrtc.Logging - Tag:WebRtcAudioTrackExternal - Message:byteBuffer.capacity: 320
2021-01-22 15:32:44,980 [network_thread - 3287] INFO  org.webrtc.Logging - Tag:WebRtcAudioTrackExternal - Message:startPlayout(sampleRate=16000, channels=1)
2021-01-22 15:32:44,981 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - starting playout for stream raf
2021-01-22 15:32:44,982 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCVideoForwarder - create decoder for name:H264 and params: {level-asymmetry-allowed=1, packetization-mode=1, profile-level-id=42e01f}
2021-01-22 15:32:44,983 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - onIceConnectionChange CHECKING for streamId: raf hash:1818084678
2021-01-22 15:32:44,984 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - onIceCandidate: 0:0:candidate:1905451164 1 udp 2122260223 10.128.0.20 54119 typ host generation 0 ufrag nblN network-id 1 network-cost 50::UNKNOWN stream id: raf
2021-01-22 15:32:44,986 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - onIceCandidate: 0:0:candidate:3637342025 1 udp 1686052607 34.121.170.191 54119 typ srflx raddr 10.128.0.20 rport 54119 generation 0 ufrag nblN network-id 1 network-cost 50:stun:172.217.212.127:19302:UNKNOWN stream id: raf
2021-01-22 15:32:45,084 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - onIceCandidate: 0:0:candidate:1058085996 1 tcp 1518280447 10.128.0.20 53559 typ host tcptype passive generation 0 ufrag nblN network-id 1 network-cost 50::UNKNOWN stream id: raf
2021-01-22 15:32:45,481 [audio-poller-raf thread-53] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - Waiting for encoder to be ready for raf hash:1818084678
2021-01-22 15:32:45,516 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - onIceConnectionChange CONNECTED for streamId: raf hash:1818084678
2021-01-22 15:32:45,549 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - onDataChannel for stream Id raf
2021-01-22 15:32:45,549 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - DataChannel State Change for stream Id raf
2021-01-22 15:32:45,582 [DecodingQueue - 3295] INFO  i.a.e.a.WebRTCVideoForwarder$VirtualVideoDecoder - initDecode width:640 height:360
2021-01-22 15:32:45,582 [DecodingQueue - 3295] INFO  i.a.enterprise.webrtc.WebRTCAdaptor - registering raf muxer with 360p and codec::H264 to webrtc adaptor
2021-01-22 15:32:45,582 [DecodingQueue - 3295] INFO  i.a.enterprise.webrtc.WebRTCAdaptor - Increasing number of live streams: 1 and stream id:raf
2021-01-22 15:32:45,583 [DecodingQueue - 3295] INFO  i.a.e.w.WebRTCPublishStreamInfoListener - streaming started raf
2021-01-22 15:32:45,597 [DecodingQueue - 3295] INFO  i.a.e.w.WebRTCPublishStreamInfoListener - Sending publish started for raf
2021-01-22 15:32:45,597 [DecodingQueue - 3295] INFO  i.a.e.w.WebRTCPublishStreamInfoListener - Notify other peers new stream (raf) joined the room
2021-01-22 15:32:47,247 [vert.x-eventloop-thread-0] INFO  i.antmedia.statistic.StatsCollector - System cpu load:2 process cpu load:4 available memory: 1270452 KB used memory(RSS): 1400368 KB
2021-01-22 15:32:47,247 [vert.x-eventloop-thread-0] INFO  i.antmedia.statistic.StatsCollector - Vertx worker queue size:0 WebRTCVertx worker queue size:0

my app setting up to play the stream:
2021-01-22 15:32:54,724 [https-jsse-nio-0.0.0.0-5443-exec-6] INFO  i.a.e.s.WebSocketLocalHandler - Web Socket opened
2021-01-22 15:32:54,755 [vert.x-eventloop-thread-1] INFO  i.a.enterprise.webrtc.WebRTCClient - startInternal time: 1611329574755
2021-01-22 15:32:54,756 [vert.x-eventloop-thread-1] INFO  org.webrtc.Logging - Tag:NativeLibrary - Message:Native library has already been loaded.
2021-01-22 15:32:54,756 [vert.x-eventloop-thread-1] INFO  org.webrtc.Logging - Tag:PeerConnectionFactory - Message:PeerConnectionFactory was initialized without an injected Loggable. Any existing Loggable will be deleted.
2021-01-22 15:32:54,756 [vert.x-eventloop-thread-1] INFO  org.webrtc.Logging - Tag:JavaAudioDeviceModule - Message:createAudioDeviceModule
2021-01-22 15:32:54,756 [vert.x-eventloop-thread-1] INFO  org.webrtc.Logging - Tag:JavaAudioDeviceModule - Message:HW NS will not be used.
2021-01-22 15:32:54,756 [vert.x-eventloop-thread-1] INFO  org.webrtc.Logging - Tag:JavaAudioDeviceModule - Message:HW AEC will not be used.
2021-01-22 15:32:54,768 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - onRenegotiationNeeded for raf
2021-01-22 15:32:54,768 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - onRenegotiationNeeded for raf
2021-01-22 15:32:54,768 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - onRenegotiationNeeded for raf
2021-01-22 15:32:54,768 [vert.x-eventloop-thread-1] INFO  i.a.e.webrtc.DataChannelRouter - add data channel player for stream:raf and player:552678579
2021-01-22 15:32:54,769 [vert.x-eventloop-thread-1] INFO  i.a.enterprise.webrtc.WebRTCClient - Timing:WebRTCClient(552678579) is initialized for raf takes 14ms
2021-01-22 15:32:54,769 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - onCreateSuccess : org.webrtc.SessionDescription@621e8660
2021-01-22 15:32:54,769 [vert.x-eventloop-thread-1] INFO  i.a.enterprise.webrtc.WebRTCClient - setting local description for stream Id raf
2021-01-22 15:32:54,770 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - onSignalingChange : HAVE_LOCAL_OFFER
2021-01-22 15:32:54,774 [vert.x-eventloop-thread-1] INFO  i.a.enterprise.webrtc.WebRTCClient - Timing:onCreateSuccess takes 19ms hash:552678579
2021-01-22 15:32:54,774 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - SdpObserverLogger - onSetSuccess for stream Id raf
2021-01-22 15:32:54,978 [network_thread - 3287] INFO  org.webrtc.Logging - Tag:WebRtcAudioTrackExternal - Message:GetPlayoutUnderrunCount
2021-01-22 15:32:54,980 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - audio stats: { timestampUs: 1611329574978287, type: inbound-rtp, id: RTCInboundRTPAudioStream_2601478237, ssrc: 2601478237, isRemote: false, mediaType: "audio", kind: "audio", trackId: "RTCMediaStreamTrack_receiver_105", transportId: "RTCTransport_0_1", codecId: "RTCCodec_0_Inbound_111", packetsReceived: 473, bytesReceived: 34874, headerBytesReceived: 13244, packetsLost: 0, lastPacketReceivedTimestamp: 1408271.754, jitter: 0.002 }
2021-01-22 15:32:54,980 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - Publish Stats StreamId: raf TransferedByte: 389985 Stream Duration: 9397 Bitrate: 41 Source IP: my.public.ip User-Agent: N/A
2021-01-22 15:32:55,279 [vert.x-eventloop-thread-1] INFO  i.a.enterprise.webrtc.WebRTCClient - setting remote description for stream Id raf for 552678579
2021-01-22 15:32:55,279 [network_thread - 3312] INFO  org.webrtc.Logging - Tag:WebRtcAudioTrackExternal - Message:GetPlayoutUnderrunCount
2021-01-22 15:32:55,280 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - onSignalingChange : STABLE
2021-01-22 15:32:55,281 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - IceConnectionState: CHECKING instance: 552678579
2021-01-22 15:32:55,281 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - Timing:onSetSuccess takes 526ms hash:552678579
2021-01-22 15:32:55,281 [vert.x-eventloop-thread-1] INFO  i.a.enterprise.webrtc.WebRTCClient - onSetSuccess for stream Id raf
2021-01-22 15:32:55,282 [EncoderQueue - 3323] INFO  i.a.e.w.c.VirtualVideoEncoderFactory - createEncoder: H264 for factory: 357580479
2021-01-22 15:32:55,283 [EncoderQueue - 3323] INFO  i.a.e.w.codec.VirtualVideoEncoder - initEncode: 1 x 1. @ 300kbps 60fps automaticResizeOn: true adjusted bitrate: 300000 for client:
2021-01-22 15:32:55,377 [https-jsse-nio-0.0.0.0-5443-exec-3] INFO  i.a.enterprise.webrtc.WebRTCClient - addIceCandidate : audio:0:candidate:1552589209 1 tcp 1518280447 192.168.2.56 9 typ host tcptype active generation 0 ufrag ToCx network-id 1 network-cost 50::UNKNOWN
2021-01-22 15:32:59,760 [vert.x-eventloop-thread-2] WARN  i.a.enterprise.webrtc.WebRTCClient - It's still not streaming so stop the webrtc client for stream: raf and client:552678579
2021-01-22 15:32:59,760 [vert.x-eventloop-thread-1] INFO  i.a.enterprise.webrtc.WebRTCClient - Stop is called for raf for 552678579
2021-01-22 15:32:59,760 [vert.x-eventloop-thread-1] INFO  i.a.enterprise.webrtc.WebRTCClient - Disposing audio source for stream Id raf
2021-01-22 15:32:59,760 [vert.x-eventloop-thread-1] INFO  i.a.e.webrtc.DataChannelRouter - remove data channel player for stream:raf and player:552678579
2021-01-22 15:32:59,761 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - DataChannel State Change for stream Id raf
2021-01-22 15:32:59,761 [vert.x-eventloop-thread-1] INFO  i.a.enterprise.webrtc.WebRTCClient - Closing and disposing peer connection for stream Id raf for 552678579
2021-01-22 15:32:59,761 [network_thread - 3312] INFO  org.webrtc.Logging - Tag:WebRtcAudioTrackExternal - Message:GetPlayoutUnderrunCount
2021-01-22 15:32:59,761 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - IceConnectionState: CLOSED instance: 552678579
2021-01-22 15:32:59,762 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - Stop is already called for raf
2021-01-22 15:32:59,762 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - onSignalingChange : CLOSED
2021-01-22 15:32:59,762 [network_thread - 3312] INFO  i.a.enterprise.webrtc.WebRTCClient - DataChannel State Change for stream Id raf
2021-01-22 15:32:59,763 [vert.x-eventloop-thread-1] INFO  i.a.enterprise.webrtc.WebRTCClient - Closing peer connection factory for raf
2021-01-22 15:32:59,763 [vert.x-eventloop-thread-1] INFO  i.a.e.w.WebRTCPlayStreamInfoListener - A viewer stopped streaming for raf
2021-01-22 15:32:59,764 [vert.x-eventloop-thread-1] INFO  i.a.enterprise.webrtc.WebRTCClient - Stopping webrtc client number of send audio packet call: 0 send video packet call: 0 client id: 552678579
2021-01-22 15:33:04,981 [network_thread - 3287] INFO  org.webrtc.Logging - Tag:WebRtcAudioTrackExternal - Message:GetPlayoutUnderrunCount
2021-01-22 15:33:04,984 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - audio stats: { timestampUs: 1611329584981421, type: inbound-rtp, id: RTCInboundRTPAudioStream_2601478237, ssrc: 2601478237, isRemote: false, mediaType: "audio", kind: "audio", trackId: "RTCMediaStreamTrack_receiver_105", transportId: "RTCTransport_0_1", codecId: "RTCCodec_0_Inbound_111", packetsReceived: 973, bytesReceived: 75294, headerBytesReceived: 27244, packetsLost: 0, lastPacketReceivedTimestamp: 1408281.754, jitter: 0.002 }
2021-01-22 15:33:04,984 [network_thread - 3287] INFO  i.a.e.adaptive.WebRTCEncoderAdaptor - Publish Stats StreamId: raf TransferedByte: 784380 Stream Duration: 19401 Bitrate: 40 Source IP: my.public.ip User-Agent: N/A

Link to comment
Share on other sites

  • 0

Hi Rafal,

Have a good day. Could you please check below checkpoints?
- Did you get any error when you got the description from us and set it?
- We didn't see any UDP Candidates on your server. Could you please enable TCP Candidate option in Ant Media Server and try again with this configuration? You can enable TCP Candidate option as below:
Open your application settings in /usr/local/antmedia/webapps/<Application-Name>/WEB-INF/red5-web.properties and add settings.webrtc.tcpCandidateEnabled=true in new line. 

I hope, I could help you.

Best Regards,
Selim

Link to comment
Share on other sites

 Share

×
×
  • Create New...