chore: puller already exists log add streamState

This commit is contained in:
langhuihui
2023-10-08 13:13:34 +08:00
parent b604cdd2eb
commit fb8eb106d6
5 changed files with 10 additions and 15 deletions

View File

@@ -28,6 +28,7 @@ initialize: 初始化
created: 已创建
create: 创建
timeout: 超时
"track available": 轨道可用
track: 轨道
"track timeout": 轨道超时
"last writetime": 最后写入时间

View File

@@ -48,8 +48,14 @@ func (pub *Puller) startPull(puller IPuller) {
if i := strings.Index(streamPath, "?"); i >= 0 {
streamPath = streamPath[:i]
}
if _, loaded := Pullers.LoadOrStore(streamPath, puller); loaded {
puller.Error("puller already exists")
if oldPuller, loaded := Pullers.LoadOrStore(streamPath, puller); loaded {
pub := oldPuller.(IPuller).GetPublisher()
stream = pub.Stream
if stream != nil {
puller.Error("puller already exists", zap.Int8("streamState", int8(stream.State)))
} else {
puller.Error("puller already exists", zap.Time("createAt", pub.StartTime))
}
return
}
defer func() {

View File

@@ -80,7 +80,7 @@ var StreamFSM = [len(StateNames)]map[StreamAction]StreamState{
{
ACTION_TRACKAVAILABLE: STATE_PUBLISHING,
ACTION_TIMEOUT: STATE_CLOSED,
ACTION_LASTLEAVE: STATE_CLOSED,
ACTION_LASTLEAVE: STATE_WAITCLOSE,
ACTION_CLOSE: STATE_CLOSED,
},
{

View File

@@ -64,18 +64,12 @@ func (vt *H264) WriteSliceBytes(slice []byte) {
b.Write(vt.Video.PPS)
vt.WriteSequenceHead(b)
case codec.NALU_IDR_Picture:
if vt.Value.AUList.ByteLength > 0 && !vt.Value.IFrame {
vt.Flush()
}
vt.Value.IFrame = true
vt.AppendAuBytes(slice)
case codec.NALU_Non_IDR_Picture,
codec.NALU_Data_Partition_A,
codec.NALU_Data_Partition_B,
codec.NALU_Data_Partition_C:
if vt.Value.AUList.ByteLength > 0 {
vt.Flush()
}
vt.Value.IFrame = false
vt.AppendAuBytes(slice)
case codec.NALU_SEI:

View File

@@ -66,15 +66,9 @@ func (vt *H265) WriteSliceBytes(slice []byte) {
codec.NAL_UNIT_CODED_SLICE_IDR,
codec.NAL_UNIT_CODED_SLICE_IDR_N_LP,
codec.NAL_UNIT_CODED_SLICE_CRA:
if vt.Value.AUList.ByteLength > 0 && !vt.Value.IFrame {
vt.Flush()
}
vt.Value.IFrame = true
vt.AppendAuBytes(slice)
case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9:
if vt.Value.AUList.ByteLength > 0 {
vt.Flush()
}
vt.Value.IFrame = false
vt.AppendAuBytes(slice)
case codec.NAL_UNIT_SEI, codec.NAL_UNIT_SEI_SUFFIX: