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_COMMON_TYPES_H_ | 11 #ifndef WEBRTC_COMMON_TYPES_H_ |
12 #define WEBRTC_COMMON_TYPES_H_ | 12 #define WEBRTC_COMMON_TYPES_H_ |
13 | 13 |
14 #include <stddef.h> | 14 #include <stddef.h> |
15 #include <string.h> | 15 #include <string.h> |
16 | 16 |
17 #include <ostream> | 17 #include <ostream> |
18 #include <string> | 18 #include <string> |
19 #include <vector> | 19 #include <vector> |
20 | 20 |
21 #include "webrtc/api/video/video_content_type.h" | 21 #include "webrtc/api/video/video_content_type.h" |
22 #include "webrtc/api/video/video_rotation.h" | 22 #include "webrtc/api/video/video_rotation.h" |
23 #include "webrtc/base/array_view.h" | |
23 #include "webrtc/base/checks.h" | 24 #include "webrtc/base/checks.h" |
24 #include "webrtc/base/optional.h" | 25 #include "webrtc/base/optional.h" |
25 #include "webrtc/typedefs.h" | 26 #include "webrtc/typedefs.h" |
26 | 27 |
27 #if defined(_MSC_VER) | 28 #if defined(_MSC_VER) |
28 // Disable "new behavior: elements of array will be default initialized" | 29 // Disable "new behavior: elements of array will be default initialized" |
29 // warning. Affects OverUseDetectorOptions. | 30 // warning. Affects OverUseDetectorOptions. |
30 #pragma warning(disable : 4351) | 31 #pragma warning(disable : 4351) |
31 #endif | 32 #endif |
32 | 33 |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
688 // min = x, max = y indicates that the receiver is free to adapt | 689 // min = x, max = y indicates that the receiver is free to adapt |
689 // in the range (x, y) based on network jitter. | 690 // in the range (x, y) based on network jitter. |
690 // | 691 // |
691 // Note: Given that this gets embedded in a union, it is up-to the owner to | 692 // Note: Given that this gets embedded in a union, it is up-to the owner to |
692 // initialize these values. | 693 // initialize these values. |
693 struct PlayoutDelay { | 694 struct PlayoutDelay { |
694 int min_ms; | 695 int min_ms; |
695 int max_ms; | 696 int max_ms; |
696 }; | 697 }; |
697 | 698 |
699 class StreamId { | |
stefan-webrtc
2017/04/19 06:46:16
I think we need a comment on what the definition o
danilchap
2017/04/19 08:16:55
Done.
| |
700 public: | |
701 // Stream id is limited to 16 bytes because it is the maximum length | |
702 // that can be encoded with one-byte header extensions. | |
703 static constexpr size_t kMaxSize = 16; | |
704 | |
705 StreamId() { value_[0] = 0; } | |
706 explicit StreamId(rtc::ArrayView<const char> value) { | |
707 Set(value.data(), value.size()); | |
708 } | |
709 StreamId(const StreamId&) = default; | |
710 StreamId& operator=(const StreamId&) = default; | |
711 | |
712 bool empty() const { return value_[0] == 0; } | |
713 const char* data() const { return value_; } | |
714 size_t size() const { return strnlen(value_, kMaxSize); } | |
715 | |
716 void Set(rtc::ArrayView<const uint8_t> value) { | |
717 Set(reinterpret_cast<const char*>(value.data()), value.size()); | |
718 } | |
719 void Set(const char* data, size_t size); | |
720 | |
721 friend bool operator==(const StreamId& lhs, const StreamId& rhs) { | |
722 return strncmp(lhs.value_, rhs.value_, kMaxSize) == 0; | |
723 } | |
724 friend bool operator!=(const StreamId& lhs, const StreamId& rhs) { | |
725 return !(lhs == rhs); | |
726 } | |
727 | |
728 private: | |
729 char value_[kMaxSize]; | |
730 }; | |
731 | |
698 struct RTPHeaderExtension { | 732 struct RTPHeaderExtension { |
699 RTPHeaderExtension(); | 733 RTPHeaderExtension(); |
700 | 734 |
701 bool hasTransmissionTimeOffset; | 735 bool hasTransmissionTimeOffset; |
702 int32_t transmissionTimeOffset; | 736 int32_t transmissionTimeOffset; |
703 bool hasAbsoluteSendTime; | 737 bool hasAbsoluteSendTime; |
704 uint32_t absoluteSendTime; | 738 uint32_t absoluteSendTime; |
705 bool hasTransportSequenceNumber; | 739 bool hasTransportSequenceNumber; |
706 uint16_t transportSequenceNumber; | 740 uint16_t transportSequenceNumber; |
707 | 741 |
708 // Audio Level includes both level in dBov and voiced/unvoiced bit. See: | 742 // Audio Level includes both level in dBov and voiced/unvoiced bit. See: |
709 // https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/ | 743 // https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/ |
710 bool hasAudioLevel; | 744 bool hasAudioLevel; |
711 bool voiceActivity; | 745 bool voiceActivity; |
712 uint8_t audioLevel; | 746 uint8_t audioLevel; |
713 | 747 |
714 // For Coordination of Video Orientation. See | 748 // For Coordination of Video Orientation. See |
715 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ | 749 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ |
716 // ts_126114v120700p.pdf | 750 // ts_126114v120700p.pdf |
717 bool hasVideoRotation; | 751 bool hasVideoRotation; |
718 VideoRotation videoRotation; | 752 VideoRotation videoRotation; |
719 | 753 |
720 // TODO(ilnik): Refactor this and one above to be rtc::Optional() and remove | 754 // TODO(ilnik): Refactor this and one above to be rtc::Optional() and remove |
721 // a corresponding bool flag. | 755 // a corresponding bool flag. |
722 bool hasVideoContentType; | 756 bool hasVideoContentType; |
723 VideoContentType videoContentType; | 757 VideoContentType videoContentType; |
724 | 758 |
725 PlayoutDelay playout_delay = {-1, -1}; | 759 PlayoutDelay playout_delay = {-1, -1}; |
760 | |
761 // For identification of a stream when ssrc is not signaled. See | |
762 // https://tools.ietf.org/html/draft-ietf-avtext-rid-09 | |
763 // TODO(danilchap): Update url from draft to release version. | |
764 StreamId stream_id; | |
765 StreamId repaired_stream_id; | |
726 }; | 766 }; |
727 | 767 |
728 struct RTPHeader { | 768 struct RTPHeader { |
729 RTPHeader(); | 769 RTPHeader(); |
730 | 770 |
731 bool markerBit; | 771 bool markerBit; |
732 uint8_t payloadType; | 772 uint8_t payloadType; |
733 uint16_t sequenceNumber; | 773 uint16_t sequenceNumber; |
734 uint32_t timestamp; | 774 uint32_t timestamp; |
735 uint32_t ssrc; | 775 uint32_t ssrc; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
841 enum class RtcpMode { kOff, kCompound, kReducedSize }; | 881 enum class RtcpMode { kOff, kCompound, kReducedSize }; |
842 | 882 |
843 enum NetworkState { | 883 enum NetworkState { |
844 kNetworkUp, | 884 kNetworkUp, |
845 kNetworkDown, | 885 kNetworkDown, |
846 }; | 886 }; |
847 | 887 |
848 } // namespace webrtc | 888 } // namespace webrtc |
849 | 889 |
850 #endif // WEBRTC_COMMON_TYPES_H_ | 890 #endif // WEBRTC_COMMON_TYPES_H_ |
OLD | NEW |