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

     1  // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
     2  // SPDX-License-Identifier: MIT
     3  
     4  package fmtp
     5  
     6  type av1FMTP struct {
     7  	parameters map[string]string
     8  }
     9  
    10  func (h *av1FMTP) MimeType() string {
    11  	return "video/av1"
    12  }
    13  
    14  func (h *av1FMTP) Match(b FMTP) bool {
    15  	c, ok := b.(*av1FMTP)
    16  	if !ok {
    17  		return false
    18  	}
    19  
    20  	// RTP Payload Format For AV1 (v1.0)
    21  	// https://aomediacodec.github.io/av1-rtp-spec/
    22  	// If the profile parameter is not present, it MUST be inferred to be 0 (“Main” profile).
    23  	hProfile, ok := h.parameters["profile"]
    24  	if !ok {
    25  		hProfile = "0"
    26  	}
    27  	cProfile, ok := c.parameters["profile"]
    28  	if !ok {
    29  		cProfile = "0"
    30  	}
    31  	if hProfile != cProfile {
    32  		return false
    33  	}
    34  
    35  	return true
    36  }
    37  
    38  func (h *av1FMTP) Parameter(key string) (string, bool) {
    39  	v, ok := h.parameters[key]
    40  	return v, ok
    41  }