// audioData is the full payload (it has the audio headers at the beginning of the payload), for easy forwarding
// If format == audio.AAC, audioData will contain AACPacketType at index 1
audioData is the full payload (it has the audio headers at the beginning of the payload), for easy forwarding
If format == audio.AAC, audioData will contain AACPacketType at index 1
// audioData is the full payload ( it has the audio headers at the beginning of the payload ) for easy forwarding // If format == audio . AAC audioData will contain AACPacketType at index 1
func (session *Session) onAudioMessage(format audio.Format, sampleRate audio.SampleRate, sampleSize audio.SampleSize, channels audio.Channel, payload []byte, timestamp uint32) {
	if session.OnAudio != nil {
		session.OnAudio(format, sampleRate, sampleSize, channels, payload, timestamp)
		return
	}
	if session.isClient {
		return
	}
	if format == audio.AAC && audio.AACPacketType(payload[1]) == audio.AACSequenceHeader {
		session.broadcaster.SetAacSequenceHeaderForPublisher(session.streamKey, payload)
	}
	session.broadcaster.BroadcastAudio(session.streamKey, payload, timestamp)
}
func ( session * Session ) onAudioMessage ( format audio . Format , sampleRate audio . SampleRate , sampleSize audio . SampleSize , channels audio . Channel , payload [ ] byte , timestamp uint32 ) { if session . OnAudio != nil { session . OnAudio ( format , sampleRate , sampleSize , channels , payload , timestamp ) return } if session . isClient { return } if format == audio . AAC && audio . AACPacketType ( payload [ 1 ] ) == audio . AACSequenceHeader { session . broadcaster . SetAacSequenceHeaderForPublisher ( session . streamKey , payload ) } session . broadcaster . BroadcastAudio ( session . streamKey , payload , timestamp ) }
audioData is the full payload (it has the audio headers at the beginning of the payload), for easy forwarding
If format == audio.AAC, audioData will contain AACPacketType at index 1
audioData is the full payload ( it has the audio headers at the beginning of the payload ) for easy forwarding If format == audio . AAC audioData will contain AACPacketType at index 1
// This is not for the RTMP server. RTMP servers don't have the option to specify callback. Only RTMP clients use this for now // If this is a client session, no further processing should be done. i.e: no need to broadcast, since we're only receiving data. // TODO: maybe caching the AAC/ACV sequence headers will be necessary // Cache aac sequence header to send to play back clients when they connect