Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 30 SSRC, | 30 SSRC, |
| 31 CSRC, | 31 CSRC, |
| 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 audio_level_() {} | |
|
pthatcher
2017/08/21 22:55:39
Do you even need to do audio_level_() here? I tho
Zach Stein
2017/08/22 21:29:59
I think the right thing will happen without this.
| |
| 42 | |
| 43 RtpSource(int64_t timestamp_ms, | |
| 44 uint32_t source_id, | |
| 45 RtpSourceType source_type, | |
| 46 uint8_t audio_level) | |
| 47 : timestamp_ms_(timestamp_ms), | |
| 48 source_id_(source_id), | |
| 49 source_type_(source_type), | |
| 50 audio_level_(audio_level) {} | |
|
pthatcher
2017/08/21 22:55:40
Is the other constructor (without an audio_level)
Zhi Huang
2017/08/22 00:01:19
Some internal tests will call the other constructo
Zach Stein
2017/08/22 21:29:59
Yup, some external code relies on the existing con
| |
| 41 | 51 |
| 42 int64_t timestamp_ms() const { return timestamp_ms_; } | 52 int64_t timestamp_ms() const { return timestamp_ms_; } |
| 43 void update_timestamp_ms(int64_t timestamp_ms) { | 53 void update_timestamp_ms(int64_t timestamp_ms) { |
| 44 RTC_DCHECK_LE(timestamp_ms_, timestamp_ms); | 54 RTC_DCHECK_LE(timestamp_ms_, timestamp_ms); |
| 45 timestamp_ms_ = timestamp_ms; | 55 timestamp_ms_ = timestamp_ms; |
| 46 } | 56 } |
| 47 | 57 |
| 48 // The identifier of the source can be the CSRC or the SSRC. | 58 // The identifier of the source can be the CSRC or the SSRC. |
| 49 uint32_t source_id() const { return source_id_; } | 59 uint32_t source_id() const { return source_id_; } |
| 50 | 60 |
| 51 // The source can be either a contributing source or a synchronization source. | 61 // The source can be either a contributing source or a synchronization source. |
| 52 RtpSourceType source_type() const { return source_type_; } | 62 RtpSourceType source_type() const { return source_type_; } |
| 53 | 63 |
| 54 // This isn't implemented yet and will always return an empty Optional. | 64 rtc::Optional<uint8_t> audio_level() const { return audio_level_; } |
| 55 // TODO(zhihuang): Implement this to return real audio level. | 65 void set_audio_level(rtc::Optional<uint8_t> level) { audio_level_ = level; } |
|
pthatcher
2017/08/21 22:55:39
I think "const rtc::Optional<T>&" is usually how w
Zach Stein
2017/08/22 21:29:59
Done.
| |
| 56 rtc::Optional<int8_t> audio_level() const { return rtc::Optional<int8_t>(); } | |
| 57 | 66 |
| 58 bool operator==(const RtpSource& o) const { | 67 bool operator==(const RtpSource& o) const { |
| 59 return timestamp_ms_ == o.timestamp_ms() && source_id_ == o.source_id() && | 68 return timestamp_ms_ == o.timestamp_ms() && source_id_ == o.source_id() && |
| 60 source_type_ == o.source_type(); | 69 source_type_ == o.source_type() && audio_level_ == o.audio_level_; |
| 61 } | 70 } |
| 62 | 71 |
| 63 private: | 72 private: |
| 64 int64_t timestamp_ms_; | 73 int64_t timestamp_ms_; |
| 65 uint32_t source_id_; | 74 uint32_t source_id_; |
| 66 RtpSourceType source_type_; | 75 RtpSourceType source_type_; |
| 76 rtc::Optional<uint8_t> audio_level_; | |
| 67 }; | 77 }; |
| 68 | 78 |
| 69 class RtpReceiverObserverInterface { | 79 class RtpReceiverObserverInterface { |
| 70 public: | 80 public: |
| 71 // Note: Currently if there are multiple RtpReceivers of the same media type, | 81 // Note: Currently if there are multiple RtpReceivers of the same media type, |
| 72 // they will all call OnFirstPacketReceived at once. | 82 // they will all call OnFirstPacketReceived at once. |
| 73 // | 83 // |
| 74 // In the future, it's likely that an RtpReceiver will only call | 84 // In the future, it's likely that an RtpReceiver will only call |
| 75 // OnFirstPacketReceived when a packet is received specifically for its | 85 // OnFirstPacketReceived when a packet is received specifically for its |
| 76 // SSRC/mid. | 86 // SSRC/mid. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 PROXY_CONSTMETHOD0(std::string, id) | 133 PROXY_CONSTMETHOD0(std::string, id) |
| 124 PROXY_CONSTMETHOD0(RtpParameters, GetParameters); | 134 PROXY_CONSTMETHOD0(RtpParameters, GetParameters); |
| 125 PROXY_METHOD1(bool, SetParameters, const RtpParameters&) | 135 PROXY_METHOD1(bool, SetParameters, const RtpParameters&) |
| 126 PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*); | 136 PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*); |
| 127 PROXY_CONSTMETHOD0(std::vector<RtpSource>, GetSources); | 137 PROXY_CONSTMETHOD0(std::vector<RtpSource>, GetSources); |
| 128 END_PROXY_MAP() | 138 END_PROXY_MAP() |
| 129 | 139 |
| 130 } // namespace webrtc | 140 } // namespace webrtc |
| 131 | 141 |
| 132 #endif // WEBRTC_API_RTPRECEIVERINTERFACE_H_ | 142 #endif // WEBRTC_API_RTPRECEIVERINTERFACE_H_ |
| OLD | NEW |