Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef API_RTP_HEADERS_H_ |
| 12 | #define API_RTP_HEADERS_H_ |
| 13 | |
| 14 | #include <stddef.h> |
Yves Gerey | 988cc08 | 2018-10-23 12:03:01 +0200 | [diff] [blame] | 15 | #include <stdint.h> |
Niels Möller | d57efc1 | 2019-03-22 14:02:11 +0100 | [diff] [blame] | 16 | #include <string> |
Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 17 | |
Johannes Kron | ad1d9f0 | 2018-11-09 11:12:36 +0100 | [diff] [blame] | 18 | #include "absl/types/optional.h" |
Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 19 | #include "api/array_view.h" |
Johannes Kron | 09d6588 | 2018-11-27 14:36:41 +0100 | [diff] [blame] | 20 | #include "api/video/color_space.h" |
Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 21 | #include "api/video/video_content_type.h" |
Johnny Lee | e0c8b23 | 2018-09-11 16:50:49 -0400 | [diff] [blame] | 22 | #include "api/video/video_frame_marking.h" |
Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 23 | #include "api/video/video_rotation.h" |
| 24 | #include "api/video/video_timing.h" |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 25 | #include "common_types.h" // NOLINT(build/include) |
Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 26 | |
| 27 | namespace webrtc { |
| 28 | |
Johannes Kron | 075f687 | 2019-02-14 14:41:05 +0100 | [diff] [blame] | 29 | struct FeedbackRequest { |
| 30 | // Determines whether the recv delta as specified in |
| 31 | // https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions-01 |
| 32 | // should be included. |
| 33 | bool include_timestamps; |
| 34 | // Include feedback of received packets in the range [sequence_number - |
Johannes Kron | 0da25a1 | 2019-03-06 09:34:13 +0100 | [diff] [blame] | 35 | // sequence_count + 1, sequence_number]. That is, no feedback will be sent if |
| 36 | // sequence_count is zero. |
Johannes Kron | 075f687 | 2019-02-14 14:41:05 +0100 | [diff] [blame] | 37 | int sequence_count; |
| 38 | }; |
| 39 | |
Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 40 | struct RTPHeaderExtension { |
| 41 | RTPHeaderExtension(); |
| 42 | RTPHeaderExtension(const RTPHeaderExtension& other); |
| 43 | RTPHeaderExtension& operator=(const RTPHeaderExtension& other); |
| 44 | |
| 45 | bool hasTransmissionTimeOffset; |
| 46 | int32_t transmissionTimeOffset; |
| 47 | bool hasAbsoluteSendTime; |
| 48 | uint32_t absoluteSendTime; |
| 49 | bool hasTransportSequenceNumber; |
| 50 | uint16_t transportSequenceNumber; |
Johannes Kron | 075f687 | 2019-02-14 14:41:05 +0100 | [diff] [blame] | 51 | absl::optional<FeedbackRequest> feedback_request; |
Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 52 | |
| 53 | // Audio Level includes both level in dBov and voiced/unvoiced bit. See: |
| 54 | // https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/ |
| 55 | bool hasAudioLevel; |
| 56 | bool voiceActivity; |
| 57 | uint8_t audioLevel; |
| 58 | |
| 59 | // For Coordination of Video Orientation. See |
| 60 | // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ |
| 61 | // ts_126114v120700p.pdf |
| 62 | bool hasVideoRotation; |
| 63 | VideoRotation videoRotation; |
| 64 | |
Danil Chapovalov | 0bc58cf | 2018-06-21 13:32:56 +0200 | [diff] [blame] | 65 | // TODO(ilnik): Refactor this and one above to be absl::optional() and remove |
Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 66 | // a corresponding bool flag. |
| 67 | bool hasVideoContentType; |
| 68 | VideoContentType videoContentType; |
| 69 | |
| 70 | bool has_video_timing; |
| 71 | VideoSendTiming video_timing; |
| 72 | |
Johnny Lee | e0c8b23 | 2018-09-11 16:50:49 -0400 | [diff] [blame] | 73 | bool has_frame_marking; |
| 74 | FrameMarking frame_marking; |
| 75 | |
Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 76 | PlayoutDelay playout_delay = {-1, -1}; |
| 77 | |
| 78 | // For identification of a stream when ssrc is not signaled. See |
| 79 | // https://tools.ietf.org/html/draft-ietf-avtext-rid-09 |
| 80 | // TODO(danilchap): Update url from draft to release version. |
Niels Möller | d57efc1 | 2019-03-22 14:02:11 +0100 | [diff] [blame] | 81 | std::string stream_id; |
| 82 | std::string repaired_stream_id; |
Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 83 | |
| 84 | // For identifying the media section used to interpret this RTP packet. See |
| 85 | // https://tools.ietf.org/html/draft-ietf-mmusic-sdp-bundle-negotiation-38 |
Niels Möller | d57efc1 | 2019-03-22 14:02:11 +0100 | [diff] [blame] | 86 | std::string mid; |
Johannes Kron | ad1d9f0 | 2018-11-09 11:12:36 +0100 | [diff] [blame] | 87 | |
Johannes Kron | 09d6588 | 2018-11-27 14:36:41 +0100 | [diff] [blame] | 88 | absl::optional<ColorSpace> color_space; |
Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 89 | }; |
| 90 | |
Niels Möller | 418f580 | 2019-05-08 14:24:15 +0200 | [diff] [blame^] | 91 | enum { kRtpCsrcSize = 15 }; // RFC 3550 page 13 |
| 92 | |
Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 93 | struct RTPHeader { |
| 94 | RTPHeader(); |
| 95 | RTPHeader(const RTPHeader& other); |
| 96 | RTPHeader& operator=(const RTPHeader& other); |
| 97 | |
| 98 | bool markerBit; |
| 99 | uint8_t payloadType; |
| 100 | uint16_t sequenceNumber; |
| 101 | uint32_t timestamp; |
| 102 | uint32_t ssrc; |
| 103 | uint8_t numCSRCs; |
| 104 | uint32_t arrOfCSRCs[kRtpCsrcSize]; |
| 105 | size_t paddingLength; |
| 106 | size_t headerLength; |
| 107 | int payload_type_frequency; |
| 108 | RTPHeaderExtension extension; |
| 109 | }; |
| 110 | |
| 111 | // RTCP mode to use. Compound mode is described by RFC 4585 and reduced-size |
| 112 | // RTCP mode is described by RFC 5506. |
| 113 | enum class RtcpMode { kOff, kCompound, kReducedSize }; |
| 114 | |
| 115 | enum NetworkState { |
| 116 | kNetworkUp, |
| 117 | kNetworkDown, |
| 118 | }; |
| 119 | |
Patrik Höglund | 3e11343 | 2017-12-15 14:40:10 +0100 | [diff] [blame] | 120 | } // namespace webrtc |
| 121 | |
| 122 | #endif // API_RTP_HEADERS_H_ |