From 8d886d1444357894f0335bee912976e4c474de8e Mon Sep 17 00:00:00 2001 From: yangjiechina <1534796060@qq.com> Date: Sun, 23 Jun 2024 13:45:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Drtmp=E9=9F=B3=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E4=B8=8D=E5=90=8C=E6=AD=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flv/http_flv.go | 10 ++-------- rtmp/rtmp_publisher.go | 2 +- rtmp/rtmp_stream.go | 10 ++-------- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/flv/http_flv.go b/flv/http_flv.go index 0d48abe..fe54a08 100644 --- a/flv/http_flv.go +++ b/flv/http_flv.go @@ -44,14 +44,8 @@ func (t *httpTransStream) Input(packet utils.AVPacket) error { var dts int64 var pts int64 - if utils.AVCodecIdAAC == packet.CodecId() { - dts = packet.ConvertDts(1024) - pts = packet.ConvertPts(1024) - } else { - dts = packet.ConvertDts(1000) - pts = packet.ConvertPts(1000) - } - + dts = packet.ConvertDts(1000) + pts = packet.ConvertPts(1000) if utils.AVMediaTypeAudio == packet.MediaType() { flvSize = 17 + len(packet.Data()) data = packet.Data() diff --git a/rtmp/rtmp_publisher.go b/rtmp/rtmp_publisher.go index a8cdaed..edab375 100644 --- a/rtmp/rtmp_publisher.go +++ b/rtmp/rtmp_publisher.go @@ -16,7 +16,7 @@ type Publisher struct { } func NewPublisher(sourceId string, stack *librtmp.Stack, conn net.Conn) *Publisher { - deMuxer := libflv.NewDeMuxer(libflv.TSModeRelative) + deMuxer := libflv.NewDeMuxer() publisher_ := &Publisher{PublishSource: stream.PublishSource{Id_: sourceId, Type_: stream.SourceTypeRtmp, TransDeMuxer: deMuxer, Conn: conn}, stack: stack} //设置回调,从flv解析出来的Stream和AVPacket都将统一回调到stream.PublishSource deMuxer.SetHandler(publisher_) diff --git a/rtmp/rtmp_stream.go b/rtmp/rtmp_stream.go index d1e246f..056071a 100644 --- a/rtmp/rtmp_stream.go +++ b/rtmp/rtmp_stream.go @@ -36,14 +36,8 @@ func (t *transStream) Input(packet utils.AVPacket) error { var pts int64 chunkHeaderSize := 12 - if utils.AVCodecIdAAC == packet.CodecId() { - dts = packet.ConvertDts(1024) - pts = packet.ConvertPts(1024) - } else { - dts = packet.ConvertDts(1000) - pts = packet.ConvertPts(1000) - } - + dts = packet.ConvertDts(1000) + pts = packet.ConvertPts(1000) if dts >= 0xFFFFFF { chunkHeaderSize += 4 }