2021-04-19 09:09:26 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef MEDIA_BASE_SDP_VIDEO_FORMAT_UTILS_H_
|
|
|
|
|
#define MEDIA_BASE_SDP_VIDEO_FORMAT_UTILS_H_
|
|
|
|
|
|
2024-08-29 13:00:40 +00:00
|
|
|
#include <optional>
|
|
|
|
|
|
2021-04-19 09:09:26 +02:00
|
|
|
#include "api/video_codecs/sdp_video_format.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
// Generate codec parameters that will be used as answer in an SDP negotiation
|
|
|
|
|
// based on local supported parameters and remote offered parameters. Both
|
2021-07-26 13:24:57 +02:00
|
|
|
// `local_supported_params`, `remote_offered_params`, and `answer_params`
|
2021-04-19 09:09:26 +02:00
|
|
|
// represent sendrecv media descriptions, i.e they are a mix of both encode and
|
2021-07-26 13:24:57 +02:00
|
|
|
// decode capabilities. In theory, when the profile in `local_supported_params`
|
|
|
|
|
// represent a strict superset of the profile in `remote_offered_params`, we
|
|
|
|
|
// could limit the profile in `answer_params` to the profile in
|
|
|
|
|
// `remote_offered_params`. However, to simplify the code, each supported H264
|
2021-04-19 09:09:26 +02:00
|
|
|
// profile should be listed explicitly in the list of local supported codecs,
|
|
|
|
|
// even if they are redundant. Then each local codec in the list should be
|
|
|
|
|
// tested one at a time against the remote codec, and only when the profiles are
|
|
|
|
|
// equal should this function be called. Therefore, this function does not need
|
2021-07-26 13:24:57 +02:00
|
|
|
// to handle profile intersection, and the profile of `local_supported_params`
|
|
|
|
|
// and `remote_offered_params` must be equal before calling this function. The
|
2021-04-19 09:09:26 +02:00
|
|
|
// parameters that are used when negotiating are the level part of
|
|
|
|
|
// profile-level-id and level-asymmetry-allowed.
|
|
|
|
|
void H264GenerateProfileLevelIdForAnswer(
|
2023-12-14 09:45:39 +01:00
|
|
|
const CodecParameterMap& local_supported_params,
|
|
|
|
|
const CodecParameterMap& remote_offered_params,
|
|
|
|
|
CodecParameterMap* answer_params);
|
2021-04-19 09:09:26 +02:00
|
|
|
|
2023-12-07 08:12:12 +08:00
|
|
|
#ifdef RTC_ENABLE_H265
|
|
|
|
|
// Works similarly as H264GenerateProfileLevelIdForAnswer, but generates codec
|
|
|
|
|
// parameters that will be used as answer for H.265.
|
|
|
|
|
// Media configuration parameters, except level-id, must be used symmetrically.
|
|
|
|
|
// For level-id, the highest level indicated by the answer must not be higher
|
|
|
|
|
// than that indicated by the offer.
|
|
|
|
|
void H265GenerateProfileTierLevelForAnswer(
|
2023-12-14 09:45:39 +01:00
|
|
|
const CodecParameterMap& local_supported_params,
|
|
|
|
|
const CodecParameterMap& remote_offered_params,
|
|
|
|
|
CodecParameterMap* answer_params);
|
2023-12-07 08:12:12 +08:00
|
|
|
#endif
|
|
|
|
|
|
2024-08-29 13:00:40 +00:00
|
|
|
// Parse max frame rate from SDP FMTP line. std::nullopt is returned if the
|
2021-04-19 09:09:26 +02:00
|
|
|
// field is missing or not a number.
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<int> ParseSdpForVPxMaxFrameRate(const CodecParameterMap& params);
|
2021-04-19 09:09:26 +02:00
|
|
|
|
2024-08-29 13:00:40 +00:00
|
|
|
// Parse max frame size from SDP FMTP line. std::nullopt is returned if the
|
2021-04-19 09:09:26 +02:00
|
|
|
// field is missing or not a number. Please note that the value is stored in sub
|
|
|
|
|
// blocks but the returned value is in total number of pixels.
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<int> ParseSdpForVPxMaxFrameSize(const CodecParameterMap& params);
|
2021-04-19 09:09:26 +02:00
|
|
|
|
2024-02-20 15:28:14 +01:00
|
|
|
// Determines whether the non-standard x-google-per-layer-pli fmtp is present
|
|
|
|
|
// in the parameters and has a value of "1".
|
|
|
|
|
bool SupportsPerLayerPictureLossIndication(const CodecParameterMap& params);
|
|
|
|
|
|
2021-04-19 09:09:26 +02:00
|
|
|
} // namespace webrtc
|
|
|
|
|
|
|
|
|
|
#endif // MEDIA_BASE_SDP_VIDEO_FORMAT_UTILS_H_
|