添加一些测试文件
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.videoCodec = av.H265
|
||||
// Todo: 这里是 WebCoder 需要的扩展内容
|
||||
|
||||
} else {
|
||||
client.Println("SDP Video Codec Type Not Supported", i2.Type)
|
||||
@ -810,7 +811,7 @@ func (client *RTSPClient) CodecUpdateVPS(val []byte) {
|
||||
// Println mini logging functions
|
||||
func (client *RTSPClient) Println(v ...interface{}) {
|
||||
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
|
||||
for _, nal := range nalRaw {
|
||||
if client.videoCodec == av.H265 {
|
||||
//fmt.Printf("Content Len:%d\n", len(content))
|
||||
retmap = client.handleH265Payload(nal, retmap)
|
||||
} else if client.videoCodec == av.H264 {
|
||||
retmap = client.handleH264Payload(content, nal, retmap)
|
||||
@ -183,7 +184,7 @@ func (client *RTSPClient) handleH264Payload(content, nal []byte, retmap []*av.Pa
|
||||
}
|
||||
}
|
||||
default:
|
||||
//client.Println("Unsupported NAL Type", naluType)
|
||||
client.Println("Unsupported NAL Type", naluType)
|
||||
}
|
||||
|
||||
return retmap
|
||||
@ -219,7 +220,8 @@ func (client *RTSPClient) handleH265Payload(nal []byte, retmap []*av.Packet) []*
|
||||
client.BufferRtpPacket.Write(nal[3:])
|
||||
}
|
||||
default:
|
||||
//client.Println("Unsupported Nal", naluType)
|
||||
// Todo: 这里少东西,需要处理
|
||||
client.Println("Unsupported Nal", naluType)
|
||||
}
|
||||
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