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

Side by Side Diff: webrtc/media/base/codec.cc

Issue 2528343002: H.264 packetization mode 0 (try 3) (Closed)
Patch Set: Filed issue on mode 1 = 0 Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 found != params_.end(); ++found) { 75 found != params_.end(); ++found) {
76 if (*found == *iter) { 76 if (*found == *iter) {
77 return true; 77 return true;
78 } 78 }
79 } 79 }
80 } 80 }
81 return false; 81 return false;
82 } 82 }
83 83
84 Codec::Codec(int id, const std::string& name, int clockrate) 84 Codec::Codec(int id, const std::string& name, int clockrate)
85 : id(id), name(name), clockrate(clockrate) {} 85 : id(id), name(name), clockrate(clockrate) {
86 SetDefaultParameters();
87 }
86 88
87 Codec::Codec() : id(0), clockrate(0) {} 89 Codec::Codec() : id(0), clockrate(0) {}
88 90
89 Codec::Codec(const Codec& c) = default; 91 Codec::Codec(const Codec& c) = default;
90 Codec::Codec(Codec&& c) = default; 92 Codec::Codec(Codec&& c) = default;
91 Codec::~Codec() = default; 93 Codec::~Codec() = default;
92 Codec& Codec::operator=(const Codec& c) = default; 94 Codec& Codec::operator=(const Codec& c) = default;
93 Codec& Codec::operator=(Codec&& c) = default; 95 Codec& Codec::operator=(Codec&& c) = default;
94 96
95 bool Codec::operator==(const Codec& c) const { 97 bool Codec::operator==(const Codec& c) const {
96 return this->id == c.id && // id is reserved in objective-c 98 return this->id == c.id && // id is reserved in objective-c
97 name == c.name && clockrate == c.clockrate && params == c.params && 99 name == c.name && clockrate == c.clockrate && params == c.params &&
98 feedback_params == c.feedback_params; 100 feedback_params == c.feedback_params;
99 } 101 }
100 102
101 bool Codec::Matches(const Codec& codec) const { 103 bool Codec::Matches(const Codec& codec) const {
102 // Match the codec id/name based on the typical static/dynamic name rules. 104 // Match the codec id/name based on the typical static/dynamic name rules.
103 // Matching is case-insensitive. 105 // Matching is case-insensitive.
104 const int kMaxStaticPayloadId = 95; 106 const int kMaxStaticPayloadId = 95;
105 return (id <= kMaxStaticPayloadId || codec.id <= kMaxStaticPayloadId) 107 return (id <= kMaxStaticPayloadId || codec.id <= kMaxStaticPayloadId)
106 ? (id == codec.id) 108 ? (id == codec.id)
107 : (_stricmp(name.c_str(), codec.name.c_str()) == 0); 109 : (_stricmp(name.c_str(), codec.name.c_str()) == 0);
108 } 110 }
109 111
112 void Codec::SetDefaultParameters() {
113 if (_stricmp(kH264CodecName, name.c_str()) == 0) {
114 // TODO(magjed): Move setting these parameters into webrtc::H264Encoder
115 // instead.
116 SetParam(kH264FmtpProfileLevelId, kH264ProfileLevelConstrainedBaseline);
117 SetParam(kH264FmtpLevelAsymmetryAllowed, "1");
118 SetParam(kH264FmtpPacketizationMode, "1");
119 }
sprang_webrtc 2016/12/01 16:58:56 Why was this moved here?
hta-webrtc 2016/12/01 18:26:27 Because it was the simplest way to set a default v
magjed_webrtc 2016/12/02 12:34:25 This is a step in the wrong direction. Why can't y
hta-webrtc 2016/12/02 12:48:47 Why is it a step in the wrong direction? Previous
120 }
121
110 bool Codec::GetParam(const std::string& name, std::string* out) const { 122 bool Codec::GetParam(const std::string& name, std::string* out) const {
111 CodecParameterMap::const_iterator iter = params.find(name); 123 CodecParameterMap::const_iterator iter = params.find(name);
112 if (iter == params.end()) 124 if (iter == params.end())
113 return false; 125 return false;
114 *out = iter->second; 126 *out = iter->second;
115 return true; 127 return true;
116 } 128 }
117 129
118 bool Codec::GetParam(const std::string& name, int* out) const { 130 bool Codec::GetParam(const std::string& name, int* out) const {
119 CodecParameterMap::const_iterator iter = params.find(name); 131 CodecParameterMap::const_iterator iter = params.find(name);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 if (CodecNamesEq(codec.name.c_str(), kH264CodecName) && 345 if (CodecNamesEq(codec.name.c_str(), kH264CodecName) &&
334 !IsSameH264Profile(codec.params, supported_codec.params)) { 346 !IsSameH264Profile(codec.params, supported_codec.params)) {
335 continue; 347 continue;
336 } 348 }
337 return &supported_codec; 349 return &supported_codec;
338 } 350 }
339 return nullptr; 351 return nullptr;
340 } 352 }
341 353
342 } // namespace cricket 354 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698