tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

sdp_video_format_utils.h (3275B)


      1 /*
      2 *  Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #ifndef MEDIA_BASE_SDP_VIDEO_FORMAT_UTILS_H_
     12 #define MEDIA_BASE_SDP_VIDEO_FORMAT_UTILS_H_
     13 
     14 #include <optional>
     15 
     16 #include "api/rtp_parameters.h"
     17 
     18 namespace webrtc {
     19 // Generate codec parameters that will be used as answer in an SDP negotiation
     20 // based on local supported parameters and remote offered parameters. Both
     21 // `local_supported_params`, `remote_offered_params`, and `answer_params`
     22 // represent sendrecv media descriptions, i.e they are a mix of both encode and
     23 // decode capabilities. In theory, when the profile in `local_supported_params`
     24 // represent a strict superset of the profile in `remote_offered_params`, we
     25 // could limit the profile in `answer_params` to the profile in
     26 // `remote_offered_params`. However, to simplify the code, each supported H264
     27 // profile should be listed explicitly in the list of local supported codecs,
     28 // even if they are redundant. Then each local codec in the list should be
     29 // tested one at a time against the remote codec, and only when the profiles are
     30 // equal should this function be called. Therefore, this function does not need
     31 // to handle profile intersection, and the profile of `local_supported_params`
     32 // and `remote_offered_params` must be equal before calling this function. The
     33 // parameters that are used when negotiating are the level part of
     34 // profile-level-id and level-asymmetry-allowed.
     35 void H264GenerateProfileLevelIdForAnswer(
     36    const CodecParameterMap& local_supported_params,
     37    const CodecParameterMap& remote_offered_params,
     38    CodecParameterMap* answer_params);
     39 
     40 #ifdef RTC_ENABLE_H265
     41 // Works similarly as H264GenerateProfileLevelIdForAnswer, but generates codec
     42 // parameters that will be used as answer for H.265.
     43 // Media configuration parameters, except level-id, must be used symmetrically.
     44 // For level-id, the highest level indicated by the answer must not be higher
     45 // than that indicated by the offer.
     46 void H265GenerateProfileTierLevelForAnswer(
     47    const CodecParameterMap& local_supported_params,
     48    const CodecParameterMap& remote_offered_params,
     49    CodecParameterMap* answer_params);
     50 #endif
     51 
     52 // Parse max frame rate from SDP FMTP line. std::nullopt is returned if the
     53 // field is missing or not a number.
     54 std::optional<int> ParseSdpForVPxMaxFrameRate(const CodecParameterMap& params);
     55 
     56 // Parse max frame size from SDP FMTP line. std::nullopt is returned if the
     57 // field is missing or not a number. Please note that the value is stored in sub
     58 // blocks but the returned value is in total number of pixels.
     59 std::optional<int> ParseSdpForVPxMaxFrameSize(const CodecParameterMap& params);
     60 
     61 // Determines whether the non-standard x-google-per-layer-pli fmtp is present
     62 // in the parameters and has a value of "1".
     63 bool SupportsPerLayerPictureLossIndication(const CodecParameterMap& params);
     64 
     65 }  // namespace webrtc
     66 
     67 #endif  // MEDIA_BASE_SDP_VIDEO_FORMAT_UTILS_H_