The solution of the voice intercom stuck after the cascaded network camera GB28181 streaming media protocol video platform EasyGBS

Recently, many users are very interested in the cascading of the EasyGBS video platform, and I have also received many inquiries from users. But in the voice area, it seems that there are still some problems that we need to deal with. For example, the previous article solved the problem of voice duplication after EasyGBS cascading. After dealing with the problem, there was a problem when continuing the test-voice intercom stuck. , So this article also talks about the troubleshooting process of the problem.

EasyGBS architecture 2.5D.png

We configure the upper-level platform of EasyGBS, and select the voice-supporting channel in the upper-level platform configuration information to register to the upper level.

67.png

Then the upper-level platform plays the cascaded channel, https access for intercom,

68.png

But the first time you talk at this time, the device will not make a sound, and it has been stuck. Let's analyze it again through packet capture.

69.png

After capturing the packet, you can find that the voice notification command
Broadcast\n and the device initialization registration command CSeq: 15 INVITE are normal, including the upper-level voice has been sent to the lower-level, so it should be the lower-level when sending the voice to the device. problem.

for {
			select {
			//等待级联的udp链接建立完成
			case audioOnOff := <-Server.UacAudioOnOff[key]:
				dataConn := Server.UacAudioUdpConn[key]
				if dataConn != nil {
					Server.UacAudioUdpConn[key] = nil
					bufUDP := make([]byte, 102400)

Since the value is first taken and then assigned, the value has not been assigned when the value is taken, so although this UacAudioOnOff is a channel, because it is nil when the value is taken, it will not be taken even after the assignment.

In response to this problem, we have improved the code as follows

audioOnOffChan := Server.UacAudioOnOff[key]
	if audioOnOffChan == nil {
		audioOnOffChan = make(chan bool)
		Server.UacAudioLock.RLock()
		Server.UacAudioOnOff[key] = audioOnOffChan
		Server.UacAudioLock.RUnlock()
	}

Perform a value judgment before taking the value, and then capture the packet again after modification, everything is normal.

70.png

Then start the voice intercom again, there is no problem. If you are still interested in our EasyGBS cascading, you can read this article: How does EasyGBS realize the upward cascading of video streams? All video-related solutions can visit TSINGSEE Qingxi Video , you can contact us to get a demonstration program, intuitive experience, you can also download and test at will, if you have any questions, please feel free to consult us.

EasyDarwin open source streaming media server is an open source streaming media platform framework developed and maintained by the domestic open source streaming media team TSINGSEE Qingxi Video. Since its creation and development in December 2012, it has expanded from the original single-service streaming media server form to the current open source project of the cloud platform architecture.

Guess you like

Origin blog.csdn.net/EasyGBS/article/details/108734124