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

Side by Side Diff: webrtc/common_types.h

Issue 2805023002: Add read support of RtpStreamId/RepairedRtpStreamId header extensions. (Closed)
Patch Set: Rebase Created 3 years, 8 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 | « no previous file | webrtc/common_types.cc » ('j') | webrtc/common_types.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_rotation.h" 21 #include "webrtc/api/video/video_rotation.h"
22 #include "webrtc/base/array_view.h"
22 #include "webrtc/base/checks.h" 23 #include "webrtc/base/checks.h"
23 #include "webrtc/base/optional.h" 24 #include "webrtc/base/optional.h"
24 #include "webrtc/typedefs.h" 25 #include "webrtc/typedefs.h"
25 26
26 #if defined(_MSC_VER) 27 #if defined(_MSC_VER)
27 // Disable "new behavior: elements of array will be default initialized" 28 // Disable "new behavior: elements of array will be default initialized"
28 // warning. Affects OverUseDetectorOptions. 29 // warning. Affects OverUseDetectorOptions.
29 #pragma warning(disable : 4351) 30 #pragma warning(disable : 4351)
30 #endif 31 #endif
31 32
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 // min = x, max = y indicates that the receiver is free to adapt 688 // min = x, max = y indicates that the receiver is free to adapt
688 // in the range (x, y) based on network jitter. 689 // in the range (x, y) based on network jitter.
689 // 690 //
690 // Note: Given that this gets embedded in a union, it is up-to the owner to 691 // Note: Given that this gets embedded in a union, it is up-to the owner to
691 // initialize these values. 692 // initialize these values.
692 struct PlayoutDelay { 693 struct PlayoutDelay {
693 int min_ms; 694 int min_ms;
694 int max_ms; 695 int max_ms;
695 }; 696 };
696 697
698 class StreamId {
699 public:
700 // Stream id is limited to 16 bytes because it is the maximum length
701 // that can be encoded with one-byte header extensions.
702 static constexpr size_t kMaxSize = 16;
703
704 StreamId() { value_[0] = 0; }
705 explicit StreamId(rtc::ArrayView<const char> value) {
706 Set(value.data(), value.size());
707 }
708 StreamId(const StreamId&) = default;
709 StreamId& operator=(const StreamId&) = default;
710
711 bool empty() const { return value_[0] == 0; }
712 void Set(rtc::ArrayView<const uint8_t> value) {
713 Set(value.data(), value.size());
714 }
715 void Set(const void* data, size_t size);
nisse-webrtc 2017/04/10 12:25:00 I would have expected const char* or const uint8_t
danilchap 2017/04/10 13:27:05 changed to const char* and made the cast explicit.
716
717 friend bool operator==(const StreamId& lhs, const StreamId& rhs) {
718 return strncmp(lhs.value_, rhs.value_, kMaxSize) == 0;
719 }
720
721 private:
722 char value_[kMaxSize];
723 };
724
697 struct RTPHeaderExtension { 725 struct RTPHeaderExtension {
698 RTPHeaderExtension(); 726 RTPHeaderExtension();
699 727
700 bool hasTransmissionTimeOffset; 728 bool hasTransmissionTimeOffset;
701 int32_t transmissionTimeOffset; 729 int32_t transmissionTimeOffset;
702 bool hasAbsoluteSendTime; 730 bool hasAbsoluteSendTime;
703 uint32_t absoluteSendTime; 731 uint32_t absoluteSendTime;
704 bool hasTransportSequenceNumber; 732 bool hasTransportSequenceNumber;
705 uint16_t transportSequenceNumber; 733 uint16_t transportSequenceNumber;
706 734
707 // Audio Level includes both level in dBov and voiced/unvoiced bit. See: 735 // Audio Level includes both level in dBov and voiced/unvoiced bit. See:
708 // https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/ 736 // https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/
709 bool hasAudioLevel; 737 bool hasAudioLevel;
710 bool voiceActivity; 738 bool voiceActivity;
711 uint8_t audioLevel; 739 uint8_t audioLevel;
712 740
713 // For Coordination of Video Orientation. See 741 // For Coordination of Video Orientation. See
714 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ 742 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/
715 // ts_126114v120700p.pdf 743 // ts_126114v120700p.pdf
716 bool hasVideoRotation; 744 bool hasVideoRotation;
717 VideoRotation videoRotation; 745 VideoRotation videoRotation;
718 746
719 PlayoutDelay playout_delay = {-1, -1}; 747 PlayoutDelay playout_delay = {-1, -1};
748
749 // For identification of a stream when ssrc is not signaled. See
750 // https://tools.ietf.org/html/draft-ietf-avtext-rid-09
751 // TODO(danilchap): Update url from draft to release version.
752 StreamId stream_id;
753 StreamId repaired_stream_id;
720 }; 754 };
721 755
722 struct RTPHeader { 756 struct RTPHeader {
723 RTPHeader(); 757 RTPHeader();
724 758
725 bool markerBit; 759 bool markerBit;
726 uint8_t payloadType; 760 uint8_t payloadType;
727 uint16_t sequenceNumber; 761 uint16_t sequenceNumber;
728 uint32_t timestamp; 762 uint32_t timestamp;
729 uint32_t ssrc; 763 uint32_t ssrc;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 enum class RtcpMode { kOff, kCompound, kReducedSize }; 869 enum class RtcpMode { kOff, kCompound, kReducedSize };
836 870
837 enum NetworkState { 871 enum NetworkState {
838 kNetworkUp, 872 kNetworkUp,
839 kNetworkDown, 873 kNetworkDown,
840 }; 874 };
841 875
842 } // namespace webrtc 876 } // namespace webrtc
843 877
844 #endif // WEBRTC_COMMON_TYPES_H_ 878 #endif // WEBRTC_COMMON_TYPES_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/common_types.cc » ('j') | webrtc/common_types.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698