mirror of
https://github.com/pion/webrtc.git
synced 2025-10-25 00:00:30 +08:00
Add H264 send/receive and packetization support
This commit is contained in:
committed by
John R. Bradley
parent
dfd08a5ac4
commit
cfba14cfea
@@ -34,6 +34,7 @@ type TrackType int
|
||||
const (
|
||||
VP8 TrackType = iota + 1
|
||||
VP9
|
||||
H264
|
||||
Opus
|
||||
)
|
||||
|
||||
@@ -43,6 +44,8 @@ func (t TrackType) String() string {
|
||||
return "VP8"
|
||||
case VP9:
|
||||
return "VP9"
|
||||
case H264:
|
||||
return "H264"
|
||||
case Opus:
|
||||
return "Opus"
|
||||
default:
|
||||
@@ -127,7 +130,7 @@ func (r *RTCPeerConnection) CreateAnswer() error {
|
||||
// This function returns a channel to push buffers on, and an error if the channel can't be added
|
||||
// Closing the channel ends this stream
|
||||
func (r *RTCPeerConnection) AddTrack(mediaType TrackType, clockRate uint32) (samples chan<- RTCSample, err error) {
|
||||
if mediaType != VP8 && mediaType != Opus {
|
||||
if mediaType != VP8 && mediaType != H264 && mediaType != Opus {
|
||||
panic("TODO Discarding packet, need media parsing")
|
||||
}
|
||||
|
||||
@@ -202,6 +205,8 @@ func (r *RTCPeerConnection) generateChannel(ssrc uint32, payloadType uint8) (buf
|
||||
codec = VP9
|
||||
case "opus":
|
||||
codec = Opus
|
||||
case "H264":
|
||||
codec = H264
|
||||
default:
|
||||
fmt.Printf("Codec %s in not supported by pion-WebRTC \n", codecStr)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user