tor-browser

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

dependency_descriptor.cc (1429B)


      1 /*
      2 *  Copyright (c) 2020 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 #include "api/transport/rtp/dependency_descriptor.h"
     12 
     13 #include "absl/container/inlined_vector.h"
     14 #include "absl/strings/string_view.h"
     15 #include "rtc_base/checks.h"
     16 
     17 namespace webrtc {
     18 
     19 namespace webrtc_impl {
     20 
     21 absl::InlinedVector<DecodeTargetIndication, 10> StringToDecodeTargetIndications(
     22    absl::string_view symbols) {
     23  absl::InlinedVector<DecodeTargetIndication, 10> dtis;
     24  dtis.reserve(symbols.size());
     25  for (char symbol : symbols) {
     26    DecodeTargetIndication indication;
     27    switch (symbol) {
     28      case '-':
     29        indication = DecodeTargetIndication::kNotPresent;
     30        break;
     31      case 'D':
     32        indication = DecodeTargetIndication::kDiscardable;
     33        break;
     34      case 'R':
     35        indication = DecodeTargetIndication::kRequired;
     36        break;
     37      case 'S':
     38        indication = DecodeTargetIndication::kSwitch;
     39        break;
     40      default:
     41        RTC_DCHECK_NOTREACHED();
     42    }
     43    dtis.push_back(indication);
     44  }
     45  return dtis;
     46 }
     47 
     48 }  // namespace webrtc_impl
     49 }  // namespace webrtc