github.com/pion/webrtc/v4@v4.0.1/internal/fmtp/vp9.go (about)

     1  // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
     2  // SPDX-License-Identifier: MIT
     3  
     4  package fmtp
     5  
     6  type vp9FMTP struct {
     7  	parameters map[string]string
     8  }
     9  
    10  func (h *vp9FMTP) MimeType() string {
    11  	return "video/vp9"
    12  }
    13  
    14  func (h *vp9FMTP) Match(b FMTP) bool {
    15  	c, ok := b.(*vp9FMTP)
    16  	if !ok {
    17  		return false
    18  	}
    19  
    20  	// RTP Payload Format for VP9 Video - draft-ietf-payload-vp9-16
    21  	// https://datatracker.ietf.org/doc/html/draft-ietf-payload-vp9-16
    22  	// If no profile-id is present, Profile 0 MUST be inferred
    23  	hProfileID, ok := h.parameters["profile-id"]
    24  	if !ok {
    25  		hProfileID = "0"
    26  	}
    27  	cProfileID, ok := c.parameters["profile-id"]
    28  	if !ok {
    29  		cProfileID = "0"
    30  	}
    31  	if hProfileID != cProfileID {
    32  		return false
    33  	}
    34  
    35  	return true
    36  }
    37  
    38  func (h *vp9FMTP) Parameter(key string) (string, bool) {
    39  	v, ok := h.parameters[key]
    40  	return v, ok
    41  }