适配引擎修改

This commit is contained in:
langhuihui
2021-03-06 17:24:15 +08:00
parent 8048025457
commit 677d797543
3 changed files with 6 additions and 6 deletions

2
go.mod
View File

@@ -3,7 +3,7 @@ module github.com/Monibuca/plugin-rtmp/v3
go 1.13
require (
github.com/Monibuca/engine/v3 v3.0.0-alpha6
github.com/Monibuca/engine/v3 v3.0.0-alpha7
github.com/Monibuca/utils/v3 v3.0.0-alpha5
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/pion/rtp v1.6.2 // indirect

2
go.sum
View File

@@ -10,6 +10,8 @@ github.com/Monibuca/engine/v3 v3.0.0-alpha5 h1:sXLg39SBkeiVkGcbcinXuRrYyClJvMVir
github.com/Monibuca/engine/v3 v3.0.0-alpha5/go.mod h1:V0/kfen6K5O/RLXHPsZj4DF/LboDZ0OqfeCfn35bWMo=
github.com/Monibuca/engine/v3 v3.0.0-alpha6 h1:USZa+JDVJd13rb9wmX06ZxjRCrqYTAPe5wVD+0IODEE=
github.com/Monibuca/engine/v3 v3.0.0-alpha6/go.mod h1:V0/kfen6K5O/RLXHPsZj4DF/LboDZ0OqfeCfn35bWMo=
github.com/Monibuca/engine/v3 v3.0.0-alpha7 h1:ohlsdFQCUS8i6eux+etFxLKo/IyQUgqlsNAgTIR9mDQ=
github.com/Monibuca/engine/v3 v3.0.0-alpha7/go.mod h1:eonu3UFn3W7NpHzSrACipxdAyOBCUwzlFUe1R7JjttE=
github.com/Monibuca/utils/v3 v3.0.0-alpha3 h1:n4Sq7mS1Iz8oBj2BcV4sXgKbZgix0fFLvjAfXYoiXl0=
github.com/Monibuca/utils/v3 v3.0.0-alpha3/go.mod h1:3xYmhQbgAZBHLyIMteUCd1va+1z/xnd72B585mCaT3c=
github.com/Monibuca/utils/v3 v3.0.0-alpha4 h1:pecYA89kWmtGOeY6R99d4T1epPJ1wc+jFrrJY13VD04=

View File

@@ -99,7 +99,7 @@ func processRtmp(conn net.Conn) {
// 3 AAC SSR ISO/IEC 14496-3 subpart 4
// 4 AAC LTP ISO/IEC 14496-3 subpart 4
va.SoundRate = codec.SamplingFrequencies[((config1&0x7)<<1)|(config2>>7)]
va.SoundType = (config2 >> 3) & 0x0F //声道
va.Channels = ((config2 >> 3) & 0x0F) //声道
//frameLengthFlag = (config2 >> 2) & 0x01
//dependsOnCoreCoder = (config2 >> 1) & 0x01
//extensionFlag = config2 & 0x01
@@ -119,7 +119,7 @@ func processRtmp(conn net.Conn) {
va.SoundFormat = soundFormat
va.SoundRate = codec.SoundRate[(tmp&0x0c)>>2] // 采样率 0 = 5.5 kHz or 1 = 11 kHz or 2 = 22 kHz or 3 = 44 kHz
va.SoundSize = (tmp & 0x02) >> 1 // 采样精度 0 = 8-bit samples or 1 = 16-bit samples
va.SoundType = tmp & 0x01 // 0 单声道1立体声
va.Channels = tmp&0x01 + 1 // 0 单声道1立体声
rec_audio = func(msg *Chunk) {
if msg.Timestamp == 0xffffff {
abslouteTs += msg.ExtendTimestamp
@@ -234,9 +234,7 @@ func processRtmp(conn net.Conn) {
}
}
if at != nil {
var aac byte
if at.SoundFormat == 10 {
aac = at.RtmpTag[0]
err = nc.SendMessage(SEND_FULL_AUDIO_MESSAGE, &AVPack{Payload: at.RtmpTag})
}
subscriber.OnAudio = func(pack engine.AudioPack) {
@@ -245,7 +243,7 @@ func processRtmp(conn net.Conn) {
}
t := pack.Timestamp - lastTimeStamp
lastTimeStamp = pack.Timestamp
payload :=pack.ToRTMPTag(aac)
payload := pack.ToRTMPTag(at.RtmpTag[0])
defer utils.RecycleSlice(payload)
err = nc.SendMessage(SEND_AUDIO_MESSAGE, &AVPack{Timestamp: t, Payload: payload})
}