Chromium Code Reviews| Index: webrtc/modules/pacing/include/packet_router.h |
| diff --git a/webrtc/modules/pacing/include/packet_router.h b/webrtc/modules/pacing/include/packet_router.h |
| index c1b332a6bfc6b1ad6e7af0bea989b0803a648c89..bed85cb4f70103e8f87880e549122e8b128ffaf9 100644 |
| --- a/webrtc/modules/pacing/include/packet_router.h |
| +++ b/webrtc/modules/pacing/include/packet_router.h |
| @@ -11,20 +11,21 @@ |
| #ifndef WEBRTC_MODULES_PACING_INCLUDE_PACKET_ROUTER_H_ |
| #define WEBRTC_MODULES_PACING_INCLUDE_PACKET_ROUTER_H_ |
| -#include <list> |
| +#include <map> |
| #include "webrtc/base/constructormagic.h" |
| +#include "webrtc/base/criticalsection.h" |
| #include "webrtc/base/scoped_ptr.h" |
| #include "webrtc/base/thread_annotations.h" |
| #include "webrtc/common_types.h" |
| +#include "webrtc/modules/bitrate_controller/send_time_history.h" |
|
stefan-webrtc
2015/07/22 10:49:00
Maybe this isn't the right place for the send_time
sprang_webrtc
2015/07/22 15:11:32
What would be a better place? modules/remote_bitra
stefan-webrtc
2015/07/27 12:13:49
I'm not sure... Maybe under pacing? We can keep it
sprang_webrtc
2015/07/28 13:29:27
I've move it around a few times now, trying to fit
|
| #include "webrtc/modules/pacing/include/paced_sender.h" |
| +#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" |
| +#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" |
| namespace webrtc { |
| -class CriticalSectionWrapper; |
| -class RTPFragmentationHeader; |
| class RtpRtcp; |
| -struct RTPVideoHeader; |
| // PacketRouter routes outgoing data to the correct sending RTP module, based |
| // on the simulcast layer in RTPVideoHeader. |
| @@ -35,6 +36,7 @@ class PacketRouter : public PacedSender::Callback { |
| void AddRtpModule(RtpRtcp* rtp_module); |
| void RemoveRtpModule(RtpRtcp* rtp_module); |
| + void OnSsrcChanged(); |
| // Implements PacedSender::Callback. |
| bool TimeToSendPacket(uint32_t ssrc, |
| @@ -44,14 +46,34 @@ class PacketRouter : public PacedSender::Callback { |
| size_t TimeToSendPadding(size_t bytes) override; |
| + // Enable transport wide sequence number extension headers for outgoing |
| + // RTP packets, specified by draft-holmer-rmcat-transport-wide-cc-extensions. |
| + // This also enables send time history. |
| + void EnableTransportWideFeedback(); |
| + |
| + void SetTransportWideSequenceNumber(uint16_t sequence_number); |
| + |
| + // Populate PacketInfo.send_time_ms, by looking up the send time in the |
| + // stored history index by sequence number. Returns the number of PacketInfo |
| + // instances for which the lookup was successful. |
| + size_t PopulateSendTimes(std::vector<PacketInfo>* packet_info); |
| + |
| + uint16_t AllocateSequenceNumber(); |
| + void OnPacketSent(uint16_t sequence_number, int64_t send_time); |
| + |
| private: |
| - // TODO(holmer): When the new video API has launched, remove crit_ and |
| - // assume rtp_modules_ will never change during a call. We should then also |
| - // switch rtp_modules_ to a map from ssrc to rtp module. |
| - rtc::scoped_ptr<CriticalSectionWrapper> crit_; |
| + void UpdateModuleMap() EXCLUSIVE_LOCKS_REQUIRED(ssrc_lookup_lock_); |
| + rtc::CriticalSection ssrc_lookup_lock_; |
| // Map from ssrc to sending rtp module. |
| - std::list<RtpRtcp*> rtp_modules_ GUARDED_BY(crit_.get()); |
| + std::map<uint32_t, RtpRtcp*> rtp_modules_ GUARDED_BY(ssrc_lookup_lock_); |
| + volatile int dirty_map_; |
| + |
| + bool transport_wide_seq_enabled_; |
| + volatile int transport_seq_; |
| + |
| + rtc::CriticalSection history_lock_; |
| + rtc::scoped_ptr<SendTimeHistory> send_time_history_ GUARDED_BY(history_lock_); |
| DISALLOW_COPY_AND_ASSIGN(PacketRouter); |
| }; |