Skip to content

Commit

Permalink
webrtc: fix bad quality when converting Opus from WebRTC to LL-HLS (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Nov 24, 2023
1 parent db5ba99 commit 81c803b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/protocols/mpegts/to_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func ToStream(r *mpegts.Reader, stream **stream.Stream) ([]*description.Media, e
Type: description.MediaTypeAudio,
Formats: []format.Format{&format.Opus{
PayloadTyp: 96,
IsStereo: (codec.ChannelCount == 2),
IsStereo: (codec.ChannelCount >= 2),
}},
}

Expand Down
1 change: 1 addition & 0 deletions internal/protocols/webrtc/incoming_track.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func newIncomingTrack(
case strings.ToLower(webrtc.MimeTypeOpus):
t.format = &format.Opus{
PayloadTyp: uint8(track.PayloadType()),
IsStereo: strings.Contains(track.Codec().SDPFmtpLine, "stereo=1"),
}

case strings.ToLower(webrtc.MimeTypeG722):
Expand Down
2 changes: 1 addition & 1 deletion internal/staticsources/hls/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (s *Source) Run(params defs.StaticSourceRunParams) error {
Type: description.MediaTypeAudio,
Formats: []format.Format{&format.Opus{
PayloadTyp: 96,
IsStereo: (tcodec.ChannelCount == 2),
IsStereo: (tcodec.ChannelCount >= 2),
}},
}

Expand Down

0 comments on commit 81c803b

Please sign in to comment.