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

Side by Side Diff: webrtc/common_video/h264/profile_level_id.h

Issue 2854123003: Build WebRTC with data channel only. (Closed)
Patch Set: Rebase. Created 3 years, 6 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 | « webrtc/common_video/BUILD.gn ('k') | webrtc/common_video/h264/profile_level_id.cc » ('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) 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 "webrtc/media/base/h264_profile_level_id.h"
15 #include <string>
16 15
17 #include "webrtc/base/optional.h" 16 // TODO(zhihuang): Delete this file once dependent applications switch to
18 #include "webrtc/common_types.h" 17 // including "webrtc/media/base/h264_profile_level_id.h" directly.
19
20 namespace webrtc {
21 namespace H264 {
22
23 // Map containting SDP codec parameters.
24 typedef std::map<std::string, std::string> CodecParameterMap;
25
26 // All values are equal to ten times the level number, except level 1b which is
27 // special.
28 enum Level {
29 kLevel1_b = 0,
30 kLevel1 = 10,
31 kLevel1_1 = 11,
32 kLevel1_2 = 12,
33 kLevel1_3 = 13,
34 kLevel2 = 20,
35 kLevel2_1 = 21,
36 kLevel2_2 = 22,
37 kLevel3 = 30,
38 kLevel3_1 = 31,
39 kLevel3_2 = 32,
40 kLevel4 = 40,
41 kLevel4_1 = 41,
42 kLevel4_2 = 42,
43 kLevel5 = 50,
44 kLevel5_1 = 51,
45 kLevel5_2 = 52
46 };
47
48 struct ProfileLevelId {
49 ProfileLevelId(Profile profile, Level level)
50 : profile(profile), level(level) {}
51 Profile profile;
52 Level level;
53 };
54
55 // Parse profile level id that is represented as a string of 3 hex bytes.
56 // Nothing will be returned if the string is not a recognized H264
57 // profile level id.
58 rtc::Optional<ProfileLevelId> ParseProfileLevelId(const char* str);
59
60 // Parse profile level id that is represented as a string of 3 hex bytes
61 // contained in an SDP key-value map. A default profile level id will be
62 // returned if the profile-level-id key is missing. Nothing will be returned if
63 // the key is present but the string is invalid.
64 rtc::Optional<ProfileLevelId> ParseSdpProfileLevelId(
65 const CodecParameterMap& params);
66
67 // Given that a decoder supports up to a given frame size (in pixels) at up to a
68 // given number of frames per second, return the highest H.264 level where it
69 // can guarantee that it will be able to support all valid encoded streams that
70 // are within that level.
71 rtc::Optional<Level> SupportedLevel(int max_frame_pixel_count, float max_fps);
72
73 // Returns canonical string representation as three hex bytes of the profile
74 // level id, or returns nothing for invalid profile level ids.
75 rtc::Optional<std::string> ProfileLevelIdToString(
76 const ProfileLevelId& profile_level_id);
77
78 // Generate codec parameters that will be used as answer in an SDP negotiation
79 // based on local supported parameters and remote offered parameters. Both
80 // |local_supported_params|, |remote_offered_params|, and |answer_params|
81 // represent sendrecv media descriptions, i.e they are a mix of both encode and
82 // decode capabilities. In theory, when the profile in |local_supported_params|
83 // represent a strict superset of the profile in |remote_offered_params|, we
84 // could limit the profile in |answer_params| to the profile in
85 // |remote_offered_params|. However, to simplify the code, each supported H264
86 // profile should be listed explicitly in the list of local supported codecs,
87 // even if they are redundant. Then each local codec in the list should be
88 // tested one at a time against the remote codec, and only when the profiles are
89 // equal should this function be called. Therefore, this function does not need
90 // to handle profile intersection, and the profile of |local_supported_params|
91 // and |remote_offered_params| must be equal before calling this function. The
92 // parameters that are used when negotiating are the level part of
93 // profile-level-id and level-asymmetry-allowed.
94 void GenerateProfileLevelIdForAnswer(
95 const CodecParameterMap& local_supported_params,
96 const CodecParameterMap& remote_offered_params,
97 CodecParameterMap* answer_params);
98
99 } // namespace H264
100 } // namespace webrtc
101 18
102 #endif // WEBRTC_COMMON_VIDEO_H264_PROFILE_LEVEL_ID_H_ 19 #endif // WEBRTC_COMMON_VIDEO_H264_PROFILE_LEVEL_ID_H_
OLDNEW
« no previous file with comments | « webrtc/common_video/BUILD.gn ('k') | webrtc/common_video/h264/profile_level_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698