pull/305/head
q191201771 2 years ago
parent 33bba7b487
commit 7e1b27d45a

@ -11,6 +11,7 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"github.com/q191201771/lal/pkg/rtsp"
"os" "os"
"time" "time"
@ -57,6 +58,8 @@ func (i *MySession) OnStop() {
func main() { func main() {
defer nazalog.Sync() defer nazalog.Sync()
rtsp.BaseInSessionTimestampFilterFlag = false
confFilename := parseFlag() confFilename := parseFlag()
lals := logic.NewLalServer(func(option *logic.Option) { lals := logic.NewLalServer(func(option *logic.Option) {
option.ConfFilename = confFilename option.ConfFilename = confFilename

@ -107,9 +107,9 @@ func Session2StatPull(session ISession) StatPull {
} }
} }
/** // GetFpsFrom
@note result s.Fps is not ordered //
*/ // @note result s.Fps is not ordered
func (s *StatGroup) GetFpsFrom(p *PeriodRecord, nowUnixSec int64) { func (s *StatGroup) GetFpsFrom(p *PeriodRecord, nowUnixSec int64) {
if s.Fps == nil || cap(s.Fps) < p.nRecord { if s.Fps == nil || cap(s.Fps) < p.nRecord {
s.Fps = make([]RecordPerSec, p.nRecord) s.Fps = make([]RecordPerSec, p.nRecord)

@ -1,3 +1,11 @@
// Copyright 2023, Chef. All rights reserved.
// https://github.com/q191201771/lal
//
// Use of this source code is governed by a MIT-style license
// that can be found in the License file.
//
// Author: Chef (191201771@qq.com)
package base package base
import ( import (

@ -57,6 +57,18 @@ const (
RtmpFrameTypeKey uint8 = 1 RtmpFrameTypeKey uint8 = 1
RtmpFrameTypeInter uint8 = 2 RtmpFrameTypeInter uint8 = 2
// RtmpCodecIdAvc
//
// Video tags -> VIDEODATA -> CodecID
//
// 1: JPEG (currently unused)
// 2: Sorenson H.263
// 3: Screen video
// 4: On2 VP6
// 5: On2 VP6 with alpha channel
// 6: Screen video version 2
// 7: AVC
//
RtmpCodecIdAvc uint8 = 7 RtmpCodecIdAvc uint8 = 7
RtmpCodecIdHevc uint8 = 12 RtmpCodecIdHevc uint8 = 12

@ -213,7 +213,7 @@ func (session *PubSession) runLoopTcp() error {
go func() { go func() {
lb := make([]byte, 2) lb := make([]byte, 2)
buf := nazabytes.NewBuffer(1500) buf := nazabytes.NewBuffer(1500) // 初始1500如果不够会扩容
for { for {
if _, rErr := io.ReadFull(conn, lb); rErr != nil { if _, rErr := io.ReadFull(conn, lb); rErr != nil {
nazalog.Debugf("[%s] read failed. err=%+v", session.UniqueKey(), rErr) nazalog.Debugf("[%s] read failed. err=%+v", session.UniqueKey(), rErr)

@ -36,7 +36,7 @@ import (
// go test -test.run TestDump_PsPub // go test -test.run TestDump_PsPub
func TestDump_PsPub(t *testing.T) { func TestDump_PsPub(t *testing.T) {
filename := "/tmp/record.psdata" filename := "/tmp/record.psdata"
isTcpFlag := 1 isTcpFlag := 0
b, err := os.ReadFile(filename) b, err := os.ReadFile(filename)
if len(b) == 0 || err != nil { if len(b) == 0 || err != nil {
@ -76,6 +76,9 @@ func testPushFile(addr string, filename string, isTcpFlag int) {
break break
} }
nazalog.Debugf("%s", m.DebugString()) nazalog.Debugf("%s", m.DebugString())
if m.Typ == base.DumpTypeInnerFileHeaderData {
continue
}
if isTcpFlag != 0 { if isTcpFlag != 0 {
bele.BePutUint16(lb, uint16(m.Len)) bele.BePutUint16(lb, uint16(m.Len))

@ -65,9 +65,9 @@ var (
RelayPushTimeoutMs = 10000 RelayPushTimeoutMs = 10000
RelayPushWriteAvTimeoutMs = 10000 RelayPushWriteAvTimeoutMs = 10000
StaticRelayPullTimeoutMs = 10000 StaticRelayPullTimeoutMs = 10000
DefaultApiCtrlStartRtpPubReqTimeoutMs = 60000 DefaultApiCtrlStartRtpPubReqTimeoutMs = 60000
DefaultApiCtrlStartRelayPullReqPullTimeoutMs = 10000 DefaultApiCtrlStartRelayPullReqPullTimeoutMs = 10000
) )

@ -8,4 +8,5 @@
package rtprtcp package rtprtcp
// MaxRtpRtcpPacketSize UDP接收时的buffer大小
const MaxRtpRtcpPacketSize = 1500 const MaxRtpRtcpPacketSize = 1500

Loading…
Cancel
Save