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

Unified Diff: webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h

Issue 1290813008: Add RemoteEstimatorProxy for capturing receive times (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed borked Rebase Created 5 years, 3 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/remote_bitrate_estimator/remote_estimator_proxy.h
diff --git a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..6d7390ec2e9b4e6963c454a85905f0f4038a0938
--- /dev/null
+++ b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_REMOTE_ESTIMATOR_PROXY_H_
+#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_REMOTE_ESTIMATOR_PROXY_H_
+
+#include <map>
+#include <vector>
+
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/modules/interface/module_common_types.h"
+#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
+
+namespace webrtc {
+
+class Clock;
+class PacketRouter;
+namespace rtcp {
+class TransportFeedback;
+}
+
+// Class used when send-side BWE is enabled: This proxy is instantiated on the
+// receive side. It buffers a number of receive timestamps and then sends
+// transport feedback messages back too the send side.
+
+class RemoteEstimatorProxy : public RemoteBitrateEstimator {
+ public:
+ RemoteEstimatorProxy(Clock* clock, PacketRouter* packet_router);
+ virtual ~RemoteEstimatorProxy();
+
+ void IncomingPacketFeedbackVector(
+ const std::vector<PacketInfo>& packet_feedback_vector) override;
+ void IncomingPacket(int64_t arrival_time_ms,
+ size_t payload_size,
+ const RTPHeader& header,
+ bool was_paced) override;
+ void RemoveStream(unsigned int ssrc) override;
+ bool LatestEstimate(std::vector<unsigned int>* ssrcs,
+ unsigned int* bitrate_bps) const override;
+ bool GetStats(ReceiveBandwidthEstimatorStats* output) const override;
+ void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override;
+ int64_t TimeUntilNextProcess() override;
+ int32_t Process() override;
+
+ static const int kDefaultProcessIntervalMs;
+ static const int kBackWindowMs;
+
+ private:
+ void OnPacketArrival(uint16_t sequence_number, int64_t arrival_time)
+ EXCLUSIVE_LOCKS_REQUIRED(&lock_);
+ bool BuildFeedbackPacket(rtcp::TransportFeedback* feedback_packetket);
+
+ Clock* const clock_;
+ PacketRouter* const packet_router_;
+ int64_t last_process_time_ms_;
+
+ rtc::CriticalSection lock_;
+
+ uint32_t media_ssrc_ GUARDED_BY(&lock_);
+ uint8_t feedback_sequence_ GUARDED_BY(&lock_);
+ SequenceNumberUnwrapper unwrapper_ GUARDED_BY(&lock_);
+ int64_t window_start_seq_ GUARDED_BY(&lock_);
+ // Map unwrapped seq -> time.
+ std::map<int64_t, int64_t> packet_arrival_times_ GUARDED_BY(&lock_);
+};
+
+} // namespace webrtc
+
+#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_REMOTE_ESTIMATOR_PROXY_H_

Powered by Google App Engine
This is Rietveld 408576698