添加一些测试文件
This commit is contained in:
parent
0e65c9d1cc
commit
49da18f263
@ -191,6 +191,7 @@ func Dial(options RTSPClientOptions) (*RTSPClient, error) {
|
|||||||
client.CodecData = append(client.CodecData, h265parser.CodecData{})
|
client.CodecData = append(client.CodecData, h265parser.CodecData{})
|
||||||
}
|
}
|
||||||
client.videoCodec = av.H265
|
client.videoCodec = av.H265
|
||||||
|
// Todo: 这里是 WebCoder 需要的扩展内容
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
client.Println("SDP Video Codec Type Not Supported", i2.Type)
|
client.Println("SDP Video Codec Type Not Supported", i2.Type)
|
||||||
@ -810,7 +811,7 @@ func (client *RTSPClient) CodecUpdateVPS(val []byte) {
|
|||||||
// Println mini logging functions
|
// Println mini logging functions
|
||||||
func (client *RTSPClient) Println(v ...interface{}) {
|
func (client *RTSPClient) Println(v ...interface{}) {
|
||||||
if client.options.Debug {
|
if client.options.Debug {
|
||||||
log.Println(v)
|
log.Println(v...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -107,6 +107,7 @@ func (client *RTSPClient) handleVideo(content []byte) ([]*av.Packet, bool) {
|
|||||||
var retmap []*av.Packet
|
var retmap []*av.Packet
|
||||||
for _, nal := range nalRaw {
|
for _, nal := range nalRaw {
|
||||||
if client.videoCodec == av.H265 {
|
if client.videoCodec == av.H265 {
|
||||||
|
//fmt.Printf("Content Len:%d\n", len(content))
|
||||||
retmap = client.handleH265Payload(nal, retmap)
|
retmap = client.handleH265Payload(nal, retmap)
|
||||||
} else if client.videoCodec == av.H264 {
|
} else if client.videoCodec == av.H264 {
|
||||||
retmap = client.handleH264Payload(content, nal, retmap)
|
retmap = client.handleH264Payload(content, nal, retmap)
|
||||||
@ -183,7 +184,7 @@ func (client *RTSPClient) handleH264Payload(content, nal []byte, retmap []*av.Pa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
//client.Println("Unsupported NAL Type", naluType)
|
client.Println("Unsupported NAL Type", naluType)
|
||||||
}
|
}
|
||||||
|
|
||||||
return retmap
|
return retmap
|
||||||
@ -219,7 +220,8 @@ func (client *RTSPClient) handleH265Payload(nal []byte, retmap []*av.Packet) []*
|
|||||||
client.BufferRtpPacket.Write(nal[3:])
|
client.BufferRtpPacket.Write(nal[3:])
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
//client.Println("Unsupported Nal", naluType)
|
// Todo: 这里少东西,需要处理
|
||||||
|
client.Println("Unsupported Nal", naluType)
|
||||||
}
|
}
|
||||||
return retmap
|
return retmap
|
||||||
}
|
}
|
||||||
|
|||||||
24
format/rtspv2/rtsp_test.go
Normal file
24
format/rtspv2/rtsp_test.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package rtspv2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test(t *testing.T) {
|
||||||
|
dial, err := Dial(RTSPClientOptions{URL: "rtsp://192.168.211.9:554/pano/0", DisableAudio: true, DialTimeout: 10 * time.Second, ReadWriteTimeout: 10 * time.Second, Debug: true})
|
||||||
|
//dial, err := Dial(RTSPClientOptions{URL: "rtsp://192.168.211.200:8554", DisableAudio: true, DialTimeout: 10 * time.Second, ReadWriteTimeout: 10 * time.Second, Debug: true})
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case signals := <-dial.Signals:
|
||||||
|
println(signals)
|
||||||
|
continue
|
||||||
|
case <-dial.OutgoingPacketQueue:
|
||||||
|
//println(time.Now().UnixMilli())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user