对拉流的头进行判断是否包含音视频

This commit is contained in:
langhuihui
2023-04-24 13:17:46 +08:00
parent a18e083e7e
commit 0976830607
3 changed files with 50 additions and 0 deletions

View File

@@ -58,6 +58,11 @@ func (puller *HDLPuller) Connect() (err error) {
if _, err = io.ReadFull(puller, head); err == nil {
if head[0] != 'F' || head[1] != 'L' || head[2] != 'V' {
err = codec.ErrInvalidFLV
} else {
configCopy := hdlConfig.GetPublishConfig()
configCopy.PubAudio = head[4]&0x04 != 0
configCopy.PubVideo = head[4]&0x01 != 0
puller.Config = &configCopy
}
}
}