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 |
11 #ifndef WEBRTC_COMMON_VIDEO_H264_PROFILE_LEVEL_ID_H_ | 11 #ifndef WEBRTC_COMMON_VIDEO_H264_PROFILE_LEVEL_ID_H_ |
12 #define WEBRTC_COMMON_VIDEO_H264_PROFILE_LEVEL_ID_H_ | 12 #define WEBRTC_COMMON_VIDEO_H264_PROFILE_LEVEL_ID_H_ |
13 | 13 |
| 14 #include <map> |
14 #include <string> | 15 #include <string> |
15 | 16 |
16 #include "webrtc/base/optional.h" | 17 #include "webrtc/base/optional.h" |
17 | 18 |
18 namespace webrtc { | 19 namespace webrtc { |
19 namespace H264 { | 20 namespace H264 { |
20 | 21 |
| 22 // Map containting SDP codec parameters. |
| 23 typedef std::map<std::string, std::string> CodecParameterMap; |
| 24 |
21 enum Profile { | 25 enum Profile { |
22 kProfileConstrainedBaseline, | 26 kProfileConstrainedBaseline, |
23 kProfileBaseline, | 27 kProfileBaseline, |
24 kProfileMain, | 28 kProfileMain, |
25 kProfileConstrainedHigh, | 29 kProfileConstrainedHigh, |
26 kProfileHigh, | 30 kProfileHigh, |
27 }; | 31 }; |
28 | 32 |
29 // All values are equal to ten times the level number, except level 1b which is | 33 // All values are equal to ten times the level number, except level 1b which is |
30 // special. | 34 // special. |
(...skipping 22 matching lines...) Expand all Loading... |
53 : profile(profile), level(level) {} | 57 : profile(profile), level(level) {} |
54 Profile profile; | 58 Profile profile; |
55 Level level; | 59 Level level; |
56 }; | 60 }; |
57 | 61 |
58 // Parse profile level id that is represented as a string of 3 hex bytes. | 62 // Parse profile level id that is represented as a string of 3 hex bytes. |
59 // Nothing will be returned if the string is not a recognized H264 | 63 // Nothing will be returned if the string is not a recognized H264 |
60 // profile level id. | 64 // profile level id. |
61 rtc::Optional<ProfileLevelId> ParseProfileLevelId(const char* str); | 65 rtc::Optional<ProfileLevelId> ParseProfileLevelId(const char* str); |
62 | 66 |
| 67 // Parse profile level id that is represented as a string of 3 hex bytes |
| 68 // contained in an SDP key-value map. A default profile level id will be |
| 69 // returned if the profile-level-id key is missing. Nothing will be returned if |
| 70 // the key is present but the string is invalid. |
| 71 rtc::Optional<ProfileLevelId> ParseSdpProfileLevelId( |
| 72 const CodecParameterMap& params); |
| 73 |
63 // Returns canonical string representation as three hex bytes of the profile | 74 // Returns canonical string representation as three hex bytes of the profile |
64 // level id, or returns nothing for invalid profile level ids. | 75 // level id, or returns nothing for invalid profile level ids. |
65 rtc::Optional<std::string> ProfileLevelIdToString( | 76 rtc::Optional<std::string> ProfileLevelIdToString( |
66 const ProfileLevelId& profile_level_id); | 77 const ProfileLevelId& profile_level_id); |
67 | 78 |
| 79 // Return negotiated profile level id based on local and remote codec |
| 80 // parameters profile-level-id and level-asymmetry-allowed. Return nothing if |
| 81 // the parameters are not compatible. |
| 82 rtc::Optional<ProfileLevelId> NegotiateProfileLevelId( |
| 83 const CodecParameterMap& local_params, |
| 84 const CodecParameterMap& remote_params); |
| 85 |
68 } // namespace H264 | 86 } // namespace H264 |
69 } // namespace webrtc | 87 } // namespace webrtc |
70 | 88 |
71 #endif // WEBRTC_COMMON_VIDEO_H264_PROFILE_LEVEL_ID_H_ | 89 #endif // WEBRTC_COMMON_VIDEO_H264_PROFILE_LEVEL_ID_H_ |
OLD | NEW |