Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: common_types.cc

Issue 2951033003: [EXPERIMENTAL] Generic stereo codec with index header sending single frames
Patch Set: Rebase and add external codec support. Created 3 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « common_types.h ('k') | common_video/include/video_frame_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 RTC_DCHECK_EQ(codecType, kVideoCodecVP8); 104 RTC_DCHECK_EQ(codecType, kVideoCodecVP8);
105 return &codec_specific_.VP8; 105 return &codec_specific_.VP8;
106 } 106 }
107 107
108 const VideoCodecVP8& VideoCodec::VP8() const { 108 const VideoCodecVP8& VideoCodec::VP8() const {
109 RTC_DCHECK_EQ(codecType, kVideoCodecVP8); 109 RTC_DCHECK_EQ(codecType, kVideoCodecVP8);
110 return codec_specific_.VP8; 110 return codec_specific_.VP8;
111 } 111 }
112 112
113 VideoCodecVP9* VideoCodec::VP9() { 113 VideoCodecVP9* VideoCodec::VP9() {
114 RTC_DCHECK_EQ(codecType, kVideoCodecVP9); 114 // RTC_DCHECK_EQ(codecType, kVideoCodecVP9);
115 return &codec_specific_.VP9; 115 return &codec_specific_.VP9;
116 } 116 }
117 117
118 const VideoCodecVP9& VideoCodec::VP9() const { 118 const VideoCodecVP9& VideoCodec::VP9() const {
119 RTC_DCHECK_EQ(codecType, kVideoCodecVP9); 119 // RTC_DCHECK_EQ(codecType, kVideoCodecVP9);
120 return codec_specific_.VP9; 120 return codec_specific_.VP9;
121 } 121 }
122 122
123 VideoCodecH264* VideoCodec::H264() { 123 VideoCodecH264* VideoCodec::H264() {
124 RTC_DCHECK_EQ(codecType, kVideoCodecH264); 124 RTC_DCHECK_EQ(codecType, kVideoCodecH264);
125 return &codec_specific_.H264; 125 return &codec_specific_.H264;
126 } 126 }
127 127
128 const VideoCodecH264& VideoCodec::H264() const { 128 const VideoCodecH264& VideoCodec::H264() const {
129 RTC_DCHECK_EQ(codecType, kVideoCodecH264); 129 RTC_DCHECK_EQ(codecType, kVideoCodecH264);
130 return codec_specific_.H264; 130 return codec_specific_.H264;
131 } 131 }
132 132
133 static const char* kPayloadNameVp8 = "VP8"; 133 static const char* kPayloadNameVp8 = "VP8";
134 static const char* kPayloadNameVp9 = "VP9"; 134 static const char* kPayloadNameVp9 = "VP9";
135 static const char* kPayloadNameH264 = "H264"; 135 static const char* kPayloadNameH264 = "H264";
136 static const char* kPayloadNameI420 = "I420"; 136 static const char* kPayloadNameI420 = "I420";
137 static const char* kPayloadNameRED = "RED"; 137 static const char* kPayloadNameRED = "RED";
138 static const char* kPayloadNameULPFEC = "ULPFEC"; 138 static const char* kPayloadNameULPFEC = "ULPFEC";
139 static const char* kPayloadNameGeneric = "Generic"; 139 static const char* kPayloadNameGeneric = "Generic";
140 static const char* kPayloadNameStereo = "stereo";
140 141
141 static bool CodecNamesEq(const char* name1, const char* name2) { 142 static bool CodecNamesEq(const char* name1, const char* name2) {
142 return _stricmp(name1, name2) == 0; 143 return _stricmp(name1, name2) == 0;
143 } 144 }
144 145
145 const char* CodecTypeToPayloadString(VideoCodecType type) { 146 const char* CodecTypeToPayloadString(VideoCodecType type) {
146 switch (type) { 147 switch (type) {
147 case kVideoCodecVP8: 148 case kVideoCodecVP8:
148 return kPayloadNameVp8; 149 return kPayloadNameVp8;
149 case kVideoCodecVP9: 150 case kVideoCodecVP9:
150 return kPayloadNameVp9; 151 return kPayloadNameVp9;
151 case kVideoCodecH264: 152 case kVideoCodecH264:
152 return kPayloadNameH264; 153 return kPayloadNameH264;
153 case kVideoCodecI420: 154 case kVideoCodecI420:
154 return kPayloadNameI420; 155 return kPayloadNameI420;
155 case kVideoCodecRED: 156 case kVideoCodecRED:
156 return kPayloadNameRED; 157 return kPayloadNameRED;
157 case kVideoCodecULPFEC: 158 case kVideoCodecULPFEC:
158 return kPayloadNameULPFEC; 159 return kPayloadNameULPFEC;
160 case kVideoCodecStereo:
161 return kPayloadNameStereo;
159 default: 162 default:
160 // Unrecognized codecs default to generic. 163 // Unrecognized codecs default to generic.
161 return kPayloadNameGeneric; 164 return kPayloadNameGeneric;
162 } 165 }
163 } 166 }
164 167
165 VideoCodecType PayloadStringToCodecType(const std::string& name) { 168 VideoCodecType PayloadStringToCodecType(const std::string& name) {
166 if (CodecNamesEq(name.c_str(), kPayloadNameVp8)) 169 if (CodecNamesEq(name.c_str(), kPayloadNameVp8))
167 return kVideoCodecVP8; 170 return kVideoCodecVP8;
168 if (CodecNamesEq(name.c_str(), kPayloadNameVp9)) 171 if (CodecNamesEq(name.c_str(), kPayloadNameVp9))
169 return kVideoCodecVP9; 172 return kVideoCodecVP9;
170 if (CodecNamesEq(name.c_str(), kPayloadNameH264)) 173 if (CodecNamesEq(name.c_str(), kPayloadNameH264))
171 return kVideoCodecH264; 174 return kVideoCodecH264;
172 if (CodecNamesEq(name.c_str(), kPayloadNameI420)) 175 if (CodecNamesEq(name.c_str(), kPayloadNameI420))
173 return kVideoCodecI420; 176 return kVideoCodecI420;
174 if (CodecNamesEq(name.c_str(), kPayloadNameRED)) 177 if (CodecNamesEq(name.c_str(), kPayloadNameRED))
175 return kVideoCodecRED; 178 return kVideoCodecRED;
176 if (CodecNamesEq(name.c_str(), kPayloadNameULPFEC)) 179 if (CodecNamesEq(name.c_str(), kPayloadNameULPFEC))
177 return kVideoCodecULPFEC; 180 return kVideoCodecULPFEC;
181 if (CodecNamesEq(name.c_str(), kPayloadNameStereo))
182 return kVideoCodecStereo;
178 return kVideoCodecGeneric; 183 return kVideoCodecGeneric;
179 } 184 }
180 185
181 const uint32_t BitrateAllocation::kMaxBitrateBps = 186 const uint32_t BitrateAllocation::kMaxBitrateBps =
182 std::numeric_limits<uint32_t>::max(); 187 std::numeric_limits<uint32_t>::max();
183 188
184 BitrateAllocation::BitrateAllocation() : sum_(0), bitrates_{} {} 189 BitrateAllocation::BitrateAllocation() : sum_(0), bitrates_{} {}
185 190
186 bool BitrateAllocation::SetBitrate(size_t spatial_index, 191 bool BitrateAllocation::SetBitrate(size_t spatial_index,
187 size_t temporal_index, 192 size_t temporal_index,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 oss << " ]"; 264 oss << " ]";
260 return oss.str(); 265 return oss.str();
261 } 266 }
262 267
263 std::ostream& BitrateAllocation::operator<<(std::ostream& os) const { 268 std::ostream& BitrateAllocation::operator<<(std::ostream& os) const {
264 os << ToString(); 269 os << ToString();
265 return os; 270 return os;
266 } 271 }
267 272
268 } // namespace webrtc 273 } // namespace webrtc
OLDNEW
« no previous file with comments | « common_types.h ('k') | common_video/include/video_frame_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698