OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 |
(...skipping 21 matching lines...) Expand all Loading... |
32 }; | 32 }; |
33 | 33 |
34 class RtpSource { | 34 class RtpSource { |
35 public: | 35 public: |
36 RtpSource() = delete; | 36 RtpSource() = delete; |
37 RtpSource(int64_t timestamp_ms, uint32_t source_id, RtpSourceType source_type) | 37 RtpSource(int64_t timestamp_ms, uint32_t source_id, RtpSourceType source_type) |
38 : timestamp_ms_(timestamp_ms), | 38 : timestamp_ms_(timestamp_ms), |
39 source_id_(source_id), | 39 source_id_(source_id), |
40 source_type_(source_type) {} | 40 source_type_(source_type) {} |
41 | 41 |
| 42 RtpSource(int64_t timestamp_ms, |
| 43 uint32_t source_id, |
| 44 RtpSourceType source_type, |
| 45 uint8_t audio_level) |
| 46 : timestamp_ms_(timestamp_ms), |
| 47 source_id_(source_id), |
| 48 source_type_(source_type), |
| 49 audio_level_(audio_level) {} |
| 50 |
42 int64_t timestamp_ms() const { return timestamp_ms_; } | 51 int64_t timestamp_ms() const { return timestamp_ms_; } |
43 void update_timestamp_ms(int64_t timestamp_ms) { | 52 void update_timestamp_ms(int64_t timestamp_ms) { |
44 RTC_DCHECK_LE(timestamp_ms_, timestamp_ms); | 53 RTC_DCHECK_LE(timestamp_ms_, timestamp_ms); |
45 timestamp_ms_ = timestamp_ms; | 54 timestamp_ms_ = timestamp_ms; |
46 } | 55 } |
47 | 56 |
48 // The identifier of the source can be the CSRC or the SSRC. | 57 // The identifier of the source can be the CSRC or the SSRC. |
49 uint32_t source_id() const { return source_id_; } | 58 uint32_t source_id() const { return source_id_; } |
50 | 59 |
51 // The source can be either a contributing source or a synchronization source. | 60 // The source can be either a contributing source or a synchronization source. |
52 RtpSourceType source_type() const { return source_type_; } | 61 RtpSourceType source_type() const { return source_type_; } |
53 | 62 |
54 // This isn't implemented yet and will always return an empty Optional. | 63 rtc::Optional<uint8_t> audio_level() const { return audio_level_; } |
55 // TODO(zhihuang): Implement this to return real audio level. | 64 void set_audio_level(const rtc::Optional<uint8_t>& level) { |
56 rtc::Optional<int8_t> audio_level() const { return rtc::Optional<int8_t>(); } | 65 audio_level_ = level; |
| 66 } |
57 | 67 |
58 bool operator==(const RtpSource& o) const { | 68 bool operator==(const RtpSource& o) const { |
59 return timestamp_ms_ == o.timestamp_ms() && source_id_ == o.source_id() && | 69 return timestamp_ms_ == o.timestamp_ms() && source_id_ == o.source_id() && |
60 source_type_ == o.source_type(); | 70 source_type_ == o.source_type() && audio_level_ == o.audio_level_; |
61 } | 71 } |
62 | 72 |
63 private: | 73 private: |
64 int64_t timestamp_ms_; | 74 int64_t timestamp_ms_; |
65 uint32_t source_id_; | 75 uint32_t source_id_; |
66 RtpSourceType source_type_; | 76 RtpSourceType source_type_; |
| 77 rtc::Optional<uint8_t> audio_level_; |
67 }; | 78 }; |
68 | 79 |
69 class RtpReceiverObserverInterface { | 80 class RtpReceiverObserverInterface { |
70 public: | 81 public: |
71 // Note: Currently if there are multiple RtpReceivers of the same media type, | 82 // Note: Currently if there are multiple RtpReceivers of the same media type, |
72 // they will all call OnFirstPacketReceived at once. | 83 // they will all call OnFirstPacketReceived at once. |
73 // | 84 // |
74 // In the future, it's likely that an RtpReceiver will only call | 85 // In the future, it's likely that an RtpReceiver will only call |
75 // OnFirstPacketReceived when a packet is received specifically for its | 86 // OnFirstPacketReceived when a packet is received specifically for its |
76 // SSRC/mid. | 87 // SSRC/mid. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 PROXY_CONSTMETHOD0(std::string, id) | 134 PROXY_CONSTMETHOD0(std::string, id) |
124 PROXY_CONSTMETHOD0(RtpParameters, GetParameters); | 135 PROXY_CONSTMETHOD0(RtpParameters, GetParameters); |
125 PROXY_METHOD1(bool, SetParameters, const RtpParameters&) | 136 PROXY_METHOD1(bool, SetParameters, const RtpParameters&) |
126 PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*); | 137 PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*); |
127 PROXY_CONSTMETHOD0(std::vector<RtpSource>, GetSources); | 138 PROXY_CONSTMETHOD0(std::vector<RtpSource>, GetSources); |
128 END_PROXY_MAP() | 139 END_PROXY_MAP() |
129 | 140 |
130 } // namespace webrtc | 141 } // namespace webrtc |
131 | 142 |
132 #endif // WEBRTC_API_RTPRECEIVERINTERFACE_H_ | 143 #endif // WEBRTC_API_RTPRECEIVERINTERFACE_H_ |
OLD | NEW |