• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 constexpr int DependencyDescriptor::kMaxSpatialIds;
20 constexpr int DependencyDescriptor::kMaxTemporalIds;
21 constexpr int DependencyDescriptor::kMaxTemplates;
22 constexpr int DependencyDescriptor::kMaxDecodeTargets;
23 
24 namespace webrtc_impl {
25 
StringToDecodeTargetIndications(absl::string_view symbols)26 absl::InlinedVector<DecodeTargetIndication, 10> StringToDecodeTargetIndications(
27     absl::string_view symbols) {
28   absl::InlinedVector<DecodeTargetIndication, 10> dtis;
29   dtis.reserve(symbols.size());
30   for (char symbol : symbols) {
31     DecodeTargetIndication indication;
32     switch (symbol) {
33       case '-':
34         indication = DecodeTargetIndication::kNotPresent;
35         break;
36       case 'D':
37         indication = DecodeTargetIndication::kDiscardable;
38         break;
39       case 'R':
40         indication = DecodeTargetIndication::kRequired;
41         break;
42       case 'S':
43         indication = DecodeTargetIndication::kSwitch;
44         break;
45       default:
46         RTC_NOTREACHED();
47     }
48     dtis.push_back(indication);
49   }
50   return dtis;
51 }
52 
53 }  // namespace webrtc_impl
54 }  // namespace webrtc
55