golanggohlsrtmpwebrtcmedia-serverobs-studiortcprtmp-proxyrtmp-serverrtprtsprtsp-proxyrtsp-relayrtsp-serversrtstreamingwebrtc-proxy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
710 B
32 lines
710 B
package webrtc |
|
|
|
import ( |
|
"github.com/bluenviron/gortsplib/v4/pkg/description" |
|
"github.com/bluenviron/gortsplib/v4/pkg/format" |
|
) |
|
|
|
// TracksToMedias converts WebRTC tracks into a media description. |
|
func TracksToMedias(tracks []*IncomingTrack) []*description.Media { |
|
ret := make([]*description.Media, len(tracks)) |
|
|
|
for i, track := range tracks { |
|
forma := track.Format() |
|
|
|
var mediaType description.MediaType |
|
|
|
switch forma.(type) { |
|
case *format.AV1, *format.VP9, *format.VP8, *format.H264: |
|
mediaType = description.MediaTypeVideo |
|
|
|
default: |
|
mediaType = description.MediaTypeAudio |
|
} |
|
|
|
ret[i] = &description.Media{ |
|
Type: mediaType, |
|
Formats: []format.Format{forma}, |
|
} |
|
} |
|
|
|
return ret |
|
}
|
|
|