mirror of https://github.com/ossrs/srs.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
826 B
Go
28 lines
826 B
Go
package rtc
|
|
|
|
import (
|
|
"github.com/pion/rtp"
|
|
"github.com/pion/rtp/codecs"
|
|
"github.com/pion/webrtc/v3"
|
|
"strings"
|
|
)
|
|
|
|
func payloaderForCodec(codec webrtc.RTPCodecCapability) (rtp.Payloader, error) {
|
|
switch strings.ToLower(codec.MimeType) {
|
|
case strings.ToLower(webrtc.MimeTypeH264):
|
|
return &codecs.H264Payloader{}, nil
|
|
case strings.ToLower(webrtc.MimeTypeOpus):
|
|
return &codecs.OpusPayloader{}, nil
|
|
case strings.ToLower(webrtc.MimeTypeVP8):
|
|
return &codecs.VP8Payloader{}, nil
|
|
case strings.ToLower(webrtc.MimeTypeVP9):
|
|
return &codecs.VP9Payloader{}, nil
|
|
case strings.ToLower(webrtc.MimeTypeG722):
|
|
return &codecs.G722Payloader{}, nil
|
|
case strings.ToLower(webrtc.MimeTypePCMU), strings.ToLower(webrtc.MimeTypePCMA):
|
|
return &codecs.G711Payloader{}, nil
|
|
default:
|
|
return nil, webrtc.ErrNoPayloaderForCodec
|
|
}
|
|
}
|