Skip to content

Commit

Permalink
Merge pull request #312 from ZSC714725/ps-g711
Browse files Browse the repository at this point in the history
[feat] ps demuxer support g711
  • Loading branch information
q191201771 authored Aug 28, 2023
2 parents 36511e0 + ce37bcd commit 6af11b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/gb28181/ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (
StreamTypeH265 = 0x24
StreamTypeAAC = 0x0f
StreamTypeG711A = 0x90 //PCMA
StreamTypeG711U = 0x91 //PCMU
StreamTypeG7221 = 0x92
StreamTypeG7231 = 0x93
StreamTypeG729 = 0x99
Expand Down
7 changes: 6 additions & 1 deletion pkg/gb28181/unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package gb28181
import (
"bytes"
"encoding/hex"

"github.com/q191201771/lal/pkg/base"
"github.com/q191201771/lal/pkg/h2645"
"github.com/q191201771/lal/pkg/rtprtcp"
Expand Down Expand Up @@ -321,6 +322,10 @@ func (p *PsUnpacker) parsePsm(rb []byte, index int) int {
switch p.audioStreamType {
case StreamTypeAAC:
p.audioPayloadType = base.AvPacketPtAac
case StreamTypeG711A:
p.audioPayloadType = base.AvPacketPtG711A
case StreamTypeG711U:
p.audioPayloadType = base.AvPacketPtG711U
default:
p.audioPayloadType = base.AvPacketPtUnknown
}
Expand Down Expand Up @@ -375,7 +380,7 @@ func (p *PsUnpacker) parseAvStream(code int, rtpts uint32, rb []byte, index int)

if code == psPackStartCodeAudioStream {
// 注意,处理音频的逻辑和处理视频的类似,参考处理视频的注释
if p.audioStreamType == StreamTypeAAC {
if p.audioStreamType == StreamTypeAAC || p.audioStreamType == StreamTypeG711A || p.audioStreamType == StreamTypeG711U {
//nazalog.Debugf("audio code=%d, length=%d, ptsDtsFlag=%d, phdl=%d, pts=%d, dts=%d,type=%d", code, length, ptsDtsFlag, phdl, pts, dts, p.audioStreamType)
if pts == -1 {
if p.preAudioPts == -1 {
Expand Down

0 comments on commit 6af11b2

Please sign in to comment.