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

Unified Diff: media/cast/sender/congestion_control.h

Issue 542883004: Cast: Merge common functionality from audio/video sender into frame_sender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 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
« no previous file with comments | « media/cast/sender/audio_sender.cc ('k') | media/cast/sender/congestion_control.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/sender/congestion_control.h
diff --git a/media/cast/sender/congestion_control.h b/media/cast/sender/congestion_control.h
index 8537037c713af28dfa08cf366ef5be11e0910eba..5d1256f75a953f77900f60223055d8aa552a465c 100644
--- a/media/cast/sender/congestion_control.h
+++ b/media/cast/sender/congestion_control.h
@@ -17,69 +17,30 @@ namespace cast {
class CongestionControl {
public:
- CongestionControl(base::TickClock* clock,
- uint32 max_bitrate_configured,
- uint32 min_bitrate_configured,
- size_t max_unacked_frames);
-
virtual ~CongestionControl();
- void UpdateRtt(base::TimeDelta rtt);
+ // Called with latest measured rtt value.
+ virtual void UpdateRtt(base::TimeDelta rtt) = 0;
// Called when an encoded frame is sent to the transport.
- void SendFrameToTransport(uint32 frame_id,
- size_t frame_size,
- base::TimeTicks when);
-
+ virtual void SendFrameToTransport(uint32 frame_id,
+ size_t frame_size,
+ base::TimeTicks when) = 0;
// Called when we receive an ACK for a frame.
- void AckFrame(uint32 frame_id, base::TimeTicks when);
+ virtual void AckFrame(uint32 frame_id, base::TimeTicks when) = 0;
// Returns the bitrate we should use for the next frame.
- uint32 GetBitrate(base::TimeTicks playout_time,
- base::TimeDelta playout_delay);
-
- private:
- struct FrameStats {
- FrameStats();
- // Time this frame was sent to the transport.
- base::TimeTicks sent_time;
- // Time this frame was acked.
- base::TimeTicks ack_time;
- // Size of encoded frame in bits.
- size_t frame_size;
- };
-
- // Calculate how much "dead air" (idle time) there is between two frames.
- static base::TimeDelta DeadTime(const FrameStats& a, const FrameStats& b);
- // Get the FrameStats for a given |frame_id|.
- // Note: Older FrameStats will be removed automatically.
- FrameStats* GetFrameStats(uint32 frame_id);
- // Calculate a safe bitrate. This is based on how much we've been
- // sending in the past.
- double CalculateSafeBitrate();
-
- // For a given frame, calculate when it might be acked.
- // (Or return the time it was acked, if it was.)
- base::TimeTicks EstimatedAckTime(uint32 frame_id, double bitrate);
- // Calculate when we start sending the data for a given frame.
- // This is done by calculating when we were done sending the previous
- // frame, but obviously can't be less than |sent_time| (if known).
- base::TimeTicks EstimatedSendingTime(uint32 frame_id, double bitrate);
+ virtual uint32 GetBitrate(base::TimeTicks playout_time,
+ base::TimeDelta playout_delay) = 0;
+};
- base::TickClock* const clock_; // Not owned by this class.
- const uint32 max_bitrate_configured_;
- const uint32 min_bitrate_configured_;
- std::deque<FrameStats> frame_stats_;
- uint32 last_frame_stats_;
- uint32 last_acked_frame_;
- uint32 last_encoded_frame_;
- base::TimeDelta rtt_;
- size_t history_size_;
- size_t acked_bits_in_history_;
- base::TimeDelta dead_time_in_history_;
+CongestionControl* NewAdaptiveCongestionControl(
+ base::TickClock* clock,
+ uint32 max_bitrate_configured,
+ uint32 min_bitrate_configured,
+ size_t max_unacked_frames);
- DISALLOW_COPY_AND_ASSIGN(CongestionControl);
-};
+CongestionControl* NewFixedCongestionControl(uint32 bitrate);
} // namespace cast
} // namespace media
« no previous file with comments | « media/cast/sender/audio_sender.cc ('k') | media/cast/sender/congestion_control.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698