Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hls: fix reading AV1 from OBS+WHIP (#3886) #4177

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/asticode/go-astits v1.13.0
github.com/bluenviron/gohlslib/v2 v2.1.2
github.com/bluenviron/gortsplib/v4 v4.12.1
github.com/bluenviron/mediacommon v1.13.3
github.com/bluenviron/mediacommon v1.13.4-0.20250119173005-20b296ab1174
github.com/datarhei/gosrt v0.8.0
github.com/fsnotify/fsnotify v1.8.0
github.com/gin-contrib/pprof v1.5.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ github.com/bluenviron/gohlslib/v2 v2.1.2 h1:FfJDt3O5f8kHIGjGMjM2+lx3P3nCgq8ig224
github.com/bluenviron/gohlslib/v2 v2.1.2/go.mod h1:5S4NoAHSVcmYxlXP7Z7xCe3qX4M9X7SuEQ7K81dd+4w=
github.com/bluenviron/gortsplib/v4 v4.12.1 h1:24wjrIXLrfwn3bcZR3eXviEAJxezHcqTpekqvnsaRic=
github.com/bluenviron/gortsplib/v4 v4.12.1/go.mod h1:xfaZE+0oRX+4z4THWi9Y59qLE5zIVzzjR5gq6k/H8lQ=
github.com/bluenviron/mediacommon v1.13.3 h1:PgprN9mAd/F5ew7Ym+UZCiCJstQVT5mZXtmN9JZvv4Y=
github.com/bluenviron/mediacommon v1.13.3/go.mod h1:RrO01FltoVUlTBGXbOYtmx1ft1oBOpLxfNGsYlaFAO8=
github.com/bluenviron/mediacommon v1.13.4-0.20250119173005-20b296ab1174 h1:uw9t6nEy6NYMmOu78ESSTTkQaE7wLCkOsr9UJ7NIRLk=
github.com/bluenviron/mediacommon v1.13.4-0.20250119173005-20b296ab1174/go.mod h1:z5LP9Tm1ZNfQV5Co54PyOzaIhGMusDfRKmh42nQSnyo=
github.com/bytedance/sonic v1.12.6 h1:/isNmCUF2x3Sh8RAp/4mh4ZGkcFAX/hLrzrK3AvpRzk=
github.com/bytedance/sonic v1.12.6/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
Expand Down
9 changes: 6 additions & 3 deletions internal/protocols/rtmp/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ func videoTrackFromSequenceStart(msg *message.VideoExSequenceStart) (format.Form
switch msg.FourCC {
case message.FourCCAV1:
// parse sequence header and metadata contained in ConfigOBUs, but do not use them
_, err := av1.BitstreamUnmarshal(msg.AV1Header.ConfigOBUs, false)
var tu av1.Bitstream
err := tu.Unmarshal(msg.AV1Header.ConfigOBUs)
if err != nil {
return nil, fmt.Errorf("invalid AV1 configuration: %w", err)
}
Expand Down Expand Up @@ -538,15 +539,17 @@ func (r *Reader) OnDataAV1(track *format.AV1, cb OnDataAV1Func) {
r.onVideoData[r.videoTrackID(track)] = func(msg message.Message) error {
switch msg := msg.(type) {
case *message.VideoExFramesX:
tu, err := av1.BitstreamUnmarshal(msg.Payload, true)
var tu av1.Bitstream
err := tu.Unmarshal(msg.Payload)
if err != nil {
return fmt.Errorf("unable to decode bitstream: %w", err)
}

cb(msg.DTS, tu)

case *message.VideoExCodedFrames:
tu, err := av1.BitstreamUnmarshal(msg.Payload, true)
var tu av1.Bitstream
err := tu.Unmarshal(msg.Payload)
if err != nil {
return fmt.Errorf("unable to decode bitstream: %w", err)
}
Expand Down
Loading