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 to represent RtpStreamId which is a string. | |
700 // Unlike std::string, it can be copied with memcpy and cleared with memset. | |
nisse-webrtc
2017/04/19 08:30:08
I'd suggest to describe it like "NUL-terminated st
danilchap
2017/04/19 08:45:22
Done
nisse-webrtc
2017/04/19 08:49:01
Ok.
| |
701 class StreamId { | |
702 public: | |
703 // Stream id is limited to 16 bytes because it is the maximum length | |
704 // that can be encoded with one-byte header extensions. | |
705 static constexpr size_t kMaxSize = 16; | |
706 | |
707 StreamId() { value_[0] = 0; } | |
708 explicit StreamId(rtc::ArrayView<const char> value) { | |
709 Set(value.data(), value.size()); | |
710 } | |
711 StreamId(const StreamId&) = default; | |
712 StreamId& operator=(const StreamId&) = default; | |
713 | |
714 bool empty() const { return value_[0] == 0; } | |
715 const char* data() const { return value_; } | |
716 size_t size() const { return strnlen(value_, kMaxSize); } | |
717 | |
718 void Set(rtc::ArrayView<const uint8_t> value) { | |
719 Set(reinterpret_cast<const char*>(value.data()), value.size()); | |
720 } | |
721 void Set(const char* data, size_t size); | |
722 | |
723 friend bool operator==(const StreamId& lhs, const StreamId& rhs) { | |
724 return strncmp(lhs.value_, rhs.value_, kMaxSize) == 0; | |
725 } | |
726 friend bool operator!=(const StreamId& lhs, const StreamId& rhs) { | |
727 return !(lhs == rhs); | |
728 } | |
729 | |
730 private: | |
731 char value_[kMaxSize]; | |
732 }; | |
733 | |
698 struct RTPHeaderExtension { | 734 struct RTPHeaderExtension { |
699 RTPHeaderExtension(); | 735 RTPHeaderExtension(); |
700 | 736 |
701 bool hasTransmissionTimeOffset; | 737 bool hasTransmissionTimeOffset; |
702 int32_t transmissionTimeOffset; | 738 int32_t transmissionTimeOffset; |
703 bool hasAbsoluteSendTime; | 739 bool hasAbsoluteSendTime; |
704 uint32_t absoluteSendTime; | 740 uint32_t absoluteSendTime; |
705 bool hasTransportSequenceNumber; | 741 bool hasTransportSequenceNumber; |
706 uint16_t transportSequenceNumber; | 742 uint16_t transportSequenceNumber; |
707 | 743 |
708 // Audio Level includes both level in dBov and voiced/unvoiced bit. See: | 744 // 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/ | 745 // https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/ |
710 bool hasAudioLevel; | 746 bool hasAudioLevel; |
711 bool voiceActivity; | 747 bool voiceActivity; |
712 uint8_t audioLevel; | 748 uint8_t audioLevel; |
713 | 749 |
714 // For Coordination of Video Orientation. See | 750 // For Coordination of Video Orientation. See |
715 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ | 751 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ |
716 // ts_126114v120700p.pdf | 752 // ts_126114v120700p.pdf |
717 bool hasVideoRotation; | 753 bool hasVideoRotation; |
718 VideoRotation videoRotation; | 754 VideoRotation videoRotation; |
719 | 755 |
720 // TODO(ilnik): Refactor this and one above to be rtc::Optional() and remove | 756 // TODO(ilnik): Refactor this and one above to be rtc::Optional() and remove |
721 // a corresponding bool flag. | 757 // a corresponding bool flag. |
722 bool hasVideoContentType; | 758 bool hasVideoContentType; |
723 VideoContentType videoContentType; | 759 VideoContentType videoContentType; |
724 | 760 |
725 PlayoutDelay playout_delay = {-1, -1}; | 761 PlayoutDelay playout_delay = {-1, -1}; |
762 | |
763 // For identification of a stream when ssrc is not signaled. See | |
764 // https://tools.ietf.org/html/draft-ietf-avtext-rid-09 | |
765 // TODO(danilchap): Update url from draft to release version. | |
766 StreamId stream_id; | |
767 StreamId repaired_stream_id; | |
726 }; | 768 }; |
727 | 769 |
728 struct RTPHeader { | 770 struct RTPHeader { |
729 RTPHeader(); | 771 RTPHeader(); |
730 | 772 |
731 bool markerBit; | 773 bool markerBit; |
732 uint8_t payloadType; | 774 uint8_t payloadType; |
733 uint16_t sequenceNumber; | 775 uint16_t sequenceNumber; |
734 uint32_t timestamp; | 776 uint32_t timestamp; |
735 uint32_t ssrc; | 777 uint32_t ssrc; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
841 enum class RtcpMode { kOff, kCompound, kReducedSize }; | 883 enum class RtcpMode { kOff, kCompound, kReducedSize }; |
842 | 884 |
843 enum NetworkState { | 885 enum NetworkState { |
844 kNetworkUp, | 886 kNetworkUp, |
845 kNetworkDown, | 887 kNetworkDown, |
846 }; | 888 }; |
847 | 889 |
848 } // namespace webrtc | 890 } // namespace webrtc |
849 | 891 |
850 #endif // WEBRTC_COMMON_TYPES_H_ | 892 #endif // WEBRTC_COMMON_TYPES_H_ |
OLD | NEW |