OLD | NEW |
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 |
11 #ifndef WEBRTC_MODULES_INCLUDE_MODULE_COMMON_TYPES_H_ | 11 #ifndef WEBRTC_MODULES_INCLUDE_MODULE_COMMON_TYPES_H_ |
12 #define WEBRTC_MODULES_INCLUDE_MODULE_COMMON_TYPES_H_ | 12 #define WEBRTC_MODULES_INCLUDE_MODULE_COMMON_TYPES_H_ |
13 | 13 |
14 #include <assert.h> | 14 #include <assert.h> |
15 #include <string.h> // memcpy | 15 #include <string.h> // memcpy |
16 | 16 |
17 #include <algorithm> | 17 #include <algorithm> |
18 #include <limits> | 18 #include <limits> |
19 | 19 |
20 #include "webrtc/api/video/video_rotation.h" | 20 #include "webrtc/api/video/video_rotation.h" |
| 21 #include "webrtc/common_video/include/video_frame.h" |
21 #include "webrtc/common_types.h" | 22 #include "webrtc/common_types.h" |
22 #include "webrtc/modules/video_coding/codecs/h264/include/h264_globals.h" | 23 #include "webrtc/modules/video_coding/codecs/h264/include/h264_globals.h" |
23 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_globals.h" | 24 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_globals.h" |
24 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9_globals.h" | 25 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9_globals.h" |
25 #include "webrtc/rtc_base/constructormagic.h" | 26 #include "webrtc/rtc_base/constructormagic.h" |
26 #include "webrtc/rtc_base/deprecation.h" | 27 #include "webrtc/rtc_base/deprecation.h" |
27 #include "webrtc/rtc_base/optional.h" | 28 #include "webrtc/rtc_base/optional.h" |
28 #include "webrtc/rtc_base/safe_conversions.h" | 29 #include "webrtc/rtc_base/safe_conversions.h" |
29 #include "webrtc/typedefs.h" | 30 #include "webrtc/typedefs.h" |
30 | 31 |
31 namespace webrtc { | 32 namespace webrtc { |
32 | 33 |
| 34 const size_t kMaxNumberOfStereoFrames = 8; |
| 35 |
33 struct RTPAudioHeader { | 36 struct RTPAudioHeader { |
34 uint8_t numEnergy; // number of valid entries in arrOfEnergy | 37 uint8_t numEnergy; // number of valid entries in arrOfEnergy |
35 uint8_t arrOfEnergy[kRtpCsrcSize]; // one energy byte (0-9) per channel | 38 uint8_t arrOfEnergy[kRtpCsrcSize]; // one energy byte (0-9) per channel |
36 bool isCNG; // is this CNG | 39 bool isCNG; // is this CNG |
37 size_t channel; // number of channels 2 = stereo | 40 size_t channel; // number of channels 2 = stereo |
38 }; | 41 }; |
39 | 42 |
| 43 enum RtpVideoCodecTypes { |
| 44 kRtpVideoNone, |
| 45 kRtpVideoGeneric, |
| 46 kRtpVideoStereo, |
| 47 kRtpVideoVp8, |
| 48 kRtpVideoVp9, |
| 49 kRtpVideoH264 |
| 50 }; |
| 51 |
| 52 struct RTPVideoHeader; |
| 53 class RTPFragmentationHeader; // forward declaration |
| 54 |
| 55 struct RTPVideoStereoInfo { |
| 56 // RTPVideoStereoInfo() : num_frames(0) {} |
| 57 // dtor to clean encoded_images |
| 58 RtpVideoCodecTypes stereoCodecType; |
| 59 uint8_t num_frames; |
| 60 uint8_t frame_index; |
| 61 const EncodedImage* encoded_images[kMaxNumberOfStereoFrames]; |
| 62 const RTPVideoHeader* rtp_video_headers[kMaxNumberOfStereoFrames]; |
| 63 const RTPFragmentationHeader* fragmentations[kMaxNumberOfStereoFrames]; |
| 64 }; |
| 65 |
40 union RTPVideoTypeHeader { | 66 union RTPVideoTypeHeader { |
41 RTPVideoHeaderVP8 VP8; | 67 RTPVideoHeaderVP8 VP8; |
42 RTPVideoHeaderVP9 VP9; | 68 RTPVideoHeaderVP9 VP9; |
43 RTPVideoHeaderH264 H264; | 69 RTPVideoHeaderH264 H264; |
44 }; | 70 }; |
45 | |
46 enum RtpVideoCodecTypes { | |
47 kRtpVideoNone, | |
48 kRtpVideoGeneric, | |
49 kRtpVideoVp8, | |
50 kRtpVideoVp9, | |
51 kRtpVideoH264 | |
52 }; | |
53 // Since RTPVideoHeader is used as a member of a union, it can't have a | 71 // Since RTPVideoHeader is used as a member of a union, it can't have a |
54 // non-trivial default constructor. | 72 // non-trivial default constructor. |
55 struct RTPVideoHeader { | 73 struct RTPVideoHeader { |
56 uint16_t width; // size | 74 uint16_t width; // size |
57 uint16_t height; | 75 uint16_t height; |
58 VideoRotation rotation; | 76 VideoRotation rotation; |
59 | 77 |
60 PlayoutDelay playout_delay; | 78 PlayoutDelay playout_delay; |
61 | 79 |
62 VideoContentType content_type; | 80 VideoContentType content_type; |
63 | 81 |
64 VideoSendTiming video_timing; | 82 VideoSendTiming video_timing; |
65 | 83 |
66 bool is_first_packet_in_frame; | 84 bool is_first_packet_in_frame; |
67 uint8_t simulcastIdx; // Index if the simulcast encoder creating | 85 uint8_t simulcastIdx; // Index if the simulcast encoder creating |
68 // this frame, 0 if not using simulcast. | 86 // this frame, 0 if not using simulcast. |
69 RtpVideoCodecTypes codec; | 87 RtpVideoCodecTypes codec; |
70 RTPVideoTypeHeader codecHeader; | 88 RTPVideoTypeHeader codecHeader; |
| 89 RTPVideoStereoInfo stereoInfo; |
71 }; | 90 }; |
| 91 |
72 union RTPTypeHeader { | 92 union RTPTypeHeader { |
73 RTPAudioHeader Audio; | 93 RTPAudioHeader Audio; |
74 RTPVideoHeader Video; | 94 RTPVideoHeader Video; |
75 }; | 95 }; |
76 | 96 |
77 struct WebRtcRTPHeader { | 97 struct WebRtcRTPHeader { |
78 RTPHeader header; | 98 RTPHeader header; |
79 FrameType frameType; | 99 FrameType frameType; |
80 RTPTypeHeader type; | 100 RTPTypeHeader type; |
81 // NTP time of the capture time in local timebase in milliseconds. | 101 // NTP time of the capture time in local timebase in milliseconds. |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 static constexpr int kNotAProbe = -1; | 642 static constexpr int kNotAProbe = -1; |
623 int send_bitrate_bps = -1; | 643 int send_bitrate_bps = -1; |
624 int probe_cluster_id = kNotAProbe; | 644 int probe_cluster_id = kNotAProbe; |
625 int probe_cluster_min_probes = -1; | 645 int probe_cluster_min_probes = -1; |
626 int probe_cluster_min_bytes = -1; | 646 int probe_cluster_min_bytes = -1; |
627 }; | 647 }; |
628 | 648 |
629 } // namespace webrtc | 649 } // namespace webrtc |
630 | 650 |
631 #endif // WEBRTC_MODULES_INCLUDE_MODULE_COMMON_TYPES_H_ | 651 #endif // WEBRTC_MODULES_INCLUDE_MODULE_COMMON_TYPES_H_ |
OLD | NEW |