mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-28 05:51:59 -08:00
update dependencies (#2113)
This commit is contained in:
parent
583fee26f6
commit
e4bd1b35a2
8 changed files with 225 additions and 290 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/bluenviron/gortsplib/v3/pkg/formats"
|
||||
"github.com/bluenviron/gortsplib/v3/pkg/formats/rtpsimpleaudio"
|
||||
"github.com/bluenviron/mediacommon/pkg/codecs/opus"
|
||||
"github.com/pion/rtp"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
|
|
@ -16,7 +17,7 @@ type UnitOpus struct {
|
|||
RTPPackets []*rtp.Packet
|
||||
NTP time.Time
|
||||
PTS time.Duration
|
||||
Frame []byte
|
||||
Packets [][]byte
|
||||
}
|
||||
|
||||
// GetRTPPackets implements Unit.
|
||||
|
|
@ -91,12 +92,12 @@ func (t *formatProcessorOpus) Process(unit Unit, hasNonRTSPReaders bool) error {
|
|||
}
|
||||
}
|
||||
|
||||
frame, pts, err := t.decoder.Decode(pkt)
|
||||
packet, pts, err := t.decoder.Decode(pkt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tunit.Frame = frame
|
||||
tunit.Packets = [][]byte{packet}
|
||||
tunit.PTS = pts
|
||||
}
|
||||
|
||||
|
|
@ -105,11 +106,18 @@ func (t *formatProcessorOpus) Process(unit Unit, hasNonRTSPReaders bool) error {
|
|||
}
|
||||
|
||||
// encode into RTP
|
||||
pkt, err := t.encoder.Encode(tunit.Frame, tunit.PTS)
|
||||
if err != nil {
|
||||
return err
|
||||
var rtpPackets []*rtp.Packet //nolint:prealloc
|
||||
pts := tunit.PTS
|
||||
for _, packet := range tunit.Packets {
|
||||
pkt, err := t.encoder.Encode(packet, pts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rtpPackets = append(rtpPackets, pkt)
|
||||
pts += opus.PacketDuration(packet)
|
||||
}
|
||||
tunit.RTPPackets = []*rtp.Packet{pkt}
|
||||
tunit.RTPPackets = rtpPackets
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue