mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-20 02:00:05 -08:00
hls, webrtc: add FromStream / ToStream (#3752)
Some checks failed
code_lint / golangci_lint (push) Has been cancelled
code_lint / mod_tidy (push) Has been cancelled
code_lint / api_docs (push) Has been cancelled
code_test / test_64 (push) Has been cancelled
code_test / test_32 (push) Has been cancelled
code_test / test_highlevel (push) Has been cancelled
Some checks failed
code_lint / golangci_lint (push) Has been cancelled
code_lint / mod_tidy (push) Has been cancelled
code_lint / api_docs (push) Has been cancelled
code_test / test_64 (push) Has been cancelled
code_test / test_32 (push) Has been cancelled
code_test / test_highlevel (push) Has been cancelled
This commit is contained in:
parent
7b01f48d40
commit
6a38c87a5b
32 changed files with 1776 additions and 1689 deletions
45
internal/protocols/webrtc/from_stream_test.go
Normal file
45
internal/protocols/webrtc/from_stream_test.go
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package webrtc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/mediamtx/internal/asyncwriter"
|
||||
"github.com/bluenviron/mediamtx/internal/stream"
|
||||
"github.com/bluenviron/mediamtx/internal/test"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestFromStream(t *testing.T) {
|
||||
for _, ca := range toFromStreamCases {
|
||||
if ca.in == nil {
|
||||
continue
|
||||
}
|
||||
t.Run(ca.name, func(t *testing.T) {
|
||||
desc := &description.Session{
|
||||
Medias: []*description.Media{{
|
||||
Formats: []format.Format{ca.in},
|
||||
}},
|
||||
}
|
||||
|
||||
stream, err := stream.New(
|
||||
1460,
|
||||
desc,
|
||||
false,
|
||||
test.NilLogger,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
defer stream.Close()
|
||||
|
||||
writer := asyncwriter.New(0, nil)
|
||||
|
||||
pc := &PeerConnection{}
|
||||
|
||||
err = FromStream(stream, writer, pc)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, ca.webrtcCaps, pc.OutgoingTracks[0].Caps)
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue