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 b1ae234
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"),

Check warning on line 75 in internal/protocols/webrtc/incoming_track.go

View check run for this annotation

Codecov / codecov/patch

internal/protocols/webrtc/incoming_track.go#L75

Added line #L75 was not covered by tests
}

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),

Check warning on line 177 in internal/staticsources/hls/source.go

View check run for this annotation

Codecov / codecov/patch

internal/staticsources/hls/source.go#L177

Added line #L177 was not covered by tests
}},
}

Expand Down

0 comments on commit b1ae234

Please sign in to comment.