This commit is contained in:
dexter
2021-10-06 09:22:59 +08:00
parent f267b1ca52
commit ac8aa96350
2 changed files with 10 additions and 9 deletions

View File

@@ -295,16 +295,15 @@ func (client *RTSP) startStream() {
return return
} }
switch b { switch b {
case 0x24: // rtp case '$': // rtp
header := make([]byte, 4) header := make([]byte, 3)
header[0] = b _, err := io.ReadFull(client.connRW, header)
_, err := io.ReadFull(client.connRW, header[1:])
if err != nil { if err != nil {
Printf("io.ReadFull err:%v", err) Printf("io.ReadFull err:%v", err)
return return
} }
channel := int(header[1]) channel := int(header[0])
length := binary.BigEndian.Uint16(header[2:]) length := binary.BigEndian.Uint16(header[1:])
content := make([]byte, length) content := make([]byte, length)
_, err = io.ReadFull(client.connRW, content) _, err = io.ReadFull(client.connRW, content)
if err != nil { if err != nil {

View File

@@ -454,6 +454,8 @@ func (session *RTSP) handleRequest(req *Request) {
case 10: case 10:
// TODO: // TODO:
sdpInfo = append(sdpInfo, fmt.Sprintf("a=rtpmap:97 MPEG4-GENERIC/%d/%d", at.SoundRate, at.Channels)) sdpInfo = append(sdpInfo, fmt.Sprintf("a=rtpmap:97 MPEG4-GENERIC/%d/%d", at.SoundRate, at.Channels))
session.UDPClient.APacketizer = rtp.NewPacketizer(1200, 97, uint32(ssrc), &AACPayloader{}, rtp.NewFixedSequencer(1), uint32(at.SoundRate))
session.UDPClient.AT = at
} }
} }
session.SDPRaw = strings.Join(sdpInfo, "\r\n") + "\r\n" session.SDPRaw = strings.Join(sdpInfo, "\r\n") + "\r\n"