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

Unified Diff: webrtc/modules/pacing/include/packet_router.h

Issue 1247293002: Add support for transport wide sequence numbers (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
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..39257bdc317e8d8f8306a50f85af62f8dbfd6093 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"
#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(modules_lock_);
+ rtc::CriticalSection modules_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(modules_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);
};

Powered by Google App Engine
This is Rietveld 408576698