|
8 | 8 | * be found in the AUTHORS file in the root of the source tree.
|
9 | 9 | */
|
10 | 10 |
|
11 |
| -#include "webrtc/base/checks.h" |
12 | 11 | #include "webrtc/common_types.h"
|
13 | 12 |
|
14 | 13 | #include <limits>
|
15 | 14 | #include <string.h>
|
16 | 15 |
|
| 16 | +#include "webrtc/base/checks.h" |
| 17 | +#include "webrtc/base/stringutils.h" |
| 18 | + |
17 | 19 | namespace webrtc {
|
18 | 20 |
|
19 | 21 | StreamDataCounters::StreamDataCounters() : first_packet_time_ms(-1) {}
|
@@ -101,41 +103,45 @@ static const char* kPayloadNameRED = "RED";
|
101 | 103 | static const char* kPayloadNameULPFEC = "ULPFEC";
|
102 | 104 | static const char* kPayloadNameGeneric = "Generic";
|
103 | 105 |
|
104 |
| -rtc::Optional<std::string> CodecTypeToPayloadName(VideoCodecType type) { |
| 106 | +static bool CodecNamesEq(const char* name1, const char* name2) { |
| 107 | + return _stricmp(name1, name2) == 0; |
| 108 | +} |
| 109 | + |
| 110 | +rtc::Optional<const char*> CodecTypeToPayloadName(VideoCodecType type) { |
105 | 111 | switch (type) {
|
106 | 112 | case kVideoCodecVP8:
|
107 |
| - return rtc::Optional<std::string>(kPayloadNameVp8); |
| 113 | + return rtc::Optional<const char*>(kPayloadNameVp8); |
108 | 114 | case kVideoCodecVP9:
|
109 |
| - return rtc::Optional<std::string>(kPayloadNameVp9); |
| 115 | + return rtc::Optional<const char*>(kPayloadNameVp9); |
110 | 116 | case kVideoCodecH264:
|
111 |
| - return rtc::Optional<std::string>(kPayloadNameH264); |
| 117 | + return rtc::Optional<const char*>(kPayloadNameH264); |
112 | 118 | case kVideoCodecI420:
|
113 |
| - return rtc::Optional<std::string>(kPayloadNameI420); |
| 119 | + return rtc::Optional<const char*>(kPayloadNameI420); |
114 | 120 | case kVideoCodecRED:
|
115 |
| - return rtc::Optional<std::string>(kPayloadNameRED); |
| 121 | + return rtc::Optional<const char*>(kPayloadNameRED); |
116 | 122 | case kVideoCodecULPFEC:
|
117 |
| - return rtc::Optional<std::string>(kPayloadNameULPFEC); |
| 123 | + return rtc::Optional<const char*>(kPayloadNameULPFEC); |
118 | 124 | case kVideoCodecGeneric:
|
119 |
| - return rtc::Optional<std::string>(kPayloadNameGeneric); |
| 125 | + return rtc::Optional<const char*>(kPayloadNameGeneric); |
120 | 126 | default:
|
121 |
| - return rtc::Optional<std::string>(); |
| 127 | + return rtc::Optional<const char*>(); |
122 | 128 | }
|
123 | 129 | }
|
124 | 130 |
|
125 | 131 | rtc::Optional<VideoCodecType> PayloadNameToCodecType(const std::string& name) {
|
126 |
| - if (name == kPayloadNameVp8) |
| 132 | + if (CodecNamesEq(name.c_str(), kPayloadNameVp8)) |
127 | 133 | return rtc::Optional<VideoCodecType>(kVideoCodecVP8);
|
128 |
| - if (name == kPayloadNameVp9) |
| 134 | + if (CodecNamesEq(name.c_str(), kPayloadNameVp9)) |
129 | 135 | return rtc::Optional<VideoCodecType>(kVideoCodecVP9);
|
130 |
| - if (name == kPayloadNameH264) |
| 136 | + if (CodecNamesEq(name.c_str(), kPayloadNameH264)) |
131 | 137 | return rtc::Optional<VideoCodecType>(kVideoCodecH264);
|
132 |
| - if (name == kPayloadNameI420) |
| 138 | + if (CodecNamesEq(name.c_str(), kPayloadNameI420)) |
133 | 139 | return rtc::Optional<VideoCodecType>(kVideoCodecI420);
|
134 |
| - if (name == kPayloadNameRED) |
| 140 | + if (CodecNamesEq(name.c_str(), kPayloadNameRED)) |
135 | 141 | return rtc::Optional<VideoCodecType>(kVideoCodecRED);
|
136 |
| - if (name == kPayloadNameULPFEC) |
| 142 | + if (CodecNamesEq(name.c_str(), kPayloadNameULPFEC)) |
137 | 143 | return rtc::Optional<VideoCodecType>(kVideoCodecULPFEC);
|
138 |
| - if (name == kPayloadNameGeneric) |
| 144 | + if (CodecNamesEq(name.c_str(), kPayloadNameGeneric)) |
139 | 145 | return rtc::Optional<VideoCodecType>(kVideoCodecGeneric);
|
140 | 146 | return rtc::Optional<VideoCodecType>();
|
141 | 147 | }
|
|
0 commit comments