Skip to content

Commit

Permalink
update processor
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 committed Oct 2, 2024
1 parent aa3c2d6 commit 866518e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
5 changes: 1 addition & 4 deletions pkg/media/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

package media

type Processor[T any] interface {
SetWriter(writer WriteCloser[T])
WriteCloser[T]
}
type Processor[T any] func(w WriteCloser[T]) WriteCloser[T]

type PCM16Processor = Processor[PCM16Sample]
8 changes: 2 additions & 6 deletions pkg/sip/media_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,11 @@ func (p *MediaPort) setupOutput() {
// TODO: this says "audio", but actually includes DTMF too
s := rtp.NewSeqWriter(newRTPStatsWriter(p.mon, "audio", p.conn))
p.audioOutRTP = s.NewStream(p.conf.AudioType, p.conf.Audio.Info().RTPClockRate)

// Encoding pipeline (LK -> SIP)
audioOut := p.conf.Audio.EncodeRTP(p.audioOutRTP)

if processor := p.conf.Processor; processor != nil {
if audioOut.SampleRate() != processor.SampleRate() {
audioOut = media.ResampleWriter(audioOut, processor.SampleRate())
}
processor.SetWriter(audioOut)
audioOut = processor
audioOut = processor(audioOut)
}

if p.conf.DTMFType != 0 {
Expand Down

0 comments on commit 866518e

Please sign in to comment.