| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 rtc::Optional<std::string> ProfileLevelIdToString( | 132 rtc::Optional<std::string> ProfileLevelIdToString( |
| 133 const ProfileLevelId& profile_level_id) { | 133 const ProfileLevelId& profile_level_id) { |
| 134 // Handle special case level == 1b. | 134 // Handle special case level == 1b. |
| 135 if (profile_level_id.level == kLevel1_b) { | 135 if (profile_level_id.level == kLevel1_b) { |
| 136 switch (profile_level_id.profile) { | 136 switch (profile_level_id.profile) { |
| 137 case kProfileConstrainedBaseline: | 137 case kProfileConstrainedBaseline: |
| 138 return rtc::Optional<std::string>("42f00b"); | 138 return rtc::Optional<std::string>("42f00b"); |
| 139 case kProfileBaseline: | 139 case kProfileBaseline: |
| 140 return rtc::Optional<std::string>("42100b"); | 140 return rtc::Optional<std::string>("42100b"); |
| 141 case kProfileMain: | 141 case kProfileMain: |
| 142 return rtc::Optional<std::string>("4D100b"); | 142 return rtc::Optional<std::string>("4d100b"); |
| 143 // Level 1b is not allowed for other profiles. | 143 // Level 1b is not allowed for other profiles. |
| 144 default: | 144 default: |
| 145 return rtc::Optional<std::string>(); | 145 return rtc::Optional<std::string>(); |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 | 148 |
| 149 const char* profile_idc_iop_string; | 149 const char* profile_idc_iop_string; |
| 150 switch (profile_level_id.profile) { | 150 switch (profile_level_id.profile) { |
| 151 case kProfileConstrainedBaseline: | 151 case kProfileConstrainedBaseline: |
| 152 profile_idc_iop_string = "42e0"; | 152 profile_idc_iop_string = "42e0"; |
| 153 break; | 153 break; |
| 154 case kProfileBaseline: | 154 case kProfileBaseline: |
| 155 profile_idc_iop_string = "4200"; | 155 profile_idc_iop_string = "4200"; |
| 156 break; | 156 break; |
| 157 case kProfileMain: | 157 case kProfileMain: |
| 158 profile_idc_iop_string = "4D00"; | 158 profile_idc_iop_string = "4d00"; |
| 159 break; | 159 break; |
| 160 case kProfileConstrainedHigh: | 160 case kProfileConstrainedHigh: |
| 161 profile_idc_iop_string = "640c"; | 161 profile_idc_iop_string = "640c"; |
| 162 break; | 162 break; |
| 163 case kProfileHigh: | 163 case kProfileHigh: |
| 164 profile_idc_iop_string = "6400"; | 164 profile_idc_iop_string = "6400"; |
| 165 break; | 165 break; |
| 166 // Unrecognized profile. | 166 // Unrecognized profile. |
| 167 default: | 167 default: |
| 168 return rtc::Optional<std::string>(); | 168 return rtc::Optional<std::string>(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 char str[7]; | 171 char str[7]; |
| 172 snprintf(str, 7u, "%s%02x", profile_idc_iop_string, profile_level_id.level); | 172 snprintf(str, 7u, "%s%02x", profile_idc_iop_string, profile_level_id.level); |
| 173 return rtc::Optional<std::string>(str); | 173 return rtc::Optional<std::string>(str); |
| 174 } | 174 } |
| 175 | 175 |
| 176 } // namespace H264 | 176 } // namespace H264 |
| 177 } // namespace webrtc | 177 } // namespace webrtc |
| OLD | NEW |