Index: media/cast/sender/frame_sender.h |
diff --git a/media/cast/sender/frame_sender.h b/media/cast/sender/frame_sender.h |
index 89e654d81baa7c631e8d04e5e21cbf0d219d3710..1afd73eeb9b97e934a84f95b50c062cf3ada6708 100644 |
--- a/media/cast/sender/frame_sender.h |
+++ b/media/cast/sender/frame_sender.h |
@@ -9,6 +9,8 @@ |
#ifndef MEDIA_CAST_SENDER_FRAME_SENDER_H_ |
#define MEDIA_CAST_SENDER_FRAME_SENDER_H_ |
+#include <deque> |
+ |
#include "base/basictypes.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
@@ -33,6 +35,8 @@ class FrameSender { |
CongestionControl* congestion_control); |
virtual ~FrameSender(); |
+ int rtp_timebase() const { return rtp_timebase_; } |
+ |
// Calling this function is only valid if the receiver supports the |
// "extra_playout_delay", rtp extension. |
void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay); |
@@ -46,9 +50,6 @@ class FrameSender { |
scoped_ptr<EncodedFrame> encoded_frame); |
protected: |
- // Returns the number of frames in the encoder's backlog. |
- virtual int GetNumberOfFramesInEncoder() const = 0; |
- |
// Called when we get an ACK for a frame. |
virtual void OnAck(uint32 frame_id) = 0; |
@@ -83,12 +84,6 @@ class FrameSender { |
// Protected for testability. |
void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); |
- // Returns true if there are too many frames in flight, or if the media |
- // duration of the frames in flight would be too high by sending the next |
- // frame. The latter metric is determined from the given |capture_time| |
- // for the next frame to be encoded and sent. |
- bool ShouldDropNextFrame(base::TimeTicks capture_time) const; |
- |
// Record or retrieve a recent history of each frame's timestamps. |
// Warning: If a frame ID too far in the past is requested, the getters will |
// silently succeed but return incorrect values. Be sure to respect |
@@ -99,6 +94,13 @@ class FrameSender { |
base::TimeTicks GetRecordedReferenceTime(uint32 frame_id) const; |
RtpTimestamp GetRecordedRtpTimestamp(uint32 frame_id) const; |
+ // Returns the number of frames that were sent but not yet acknowledged. |
+ int GetUnackedFrameCount() const; |
+ |
+ // Returns the maximum media duration currently allowed in-flight. This |
+ // fluctuates in response to the currently-measured network latency. |
+ base::TimeDelta GetAllowedInFlightMediaDuration() const; |
+ |
const base::TimeDelta rtcp_interval_; |
// The total amount of time between a frame's capture/recording on the sender |
@@ -148,14 +150,14 @@ class FrameSender { |
// STATUS_VIDEO_INITIALIZED. |
CastInitializationStatus cast_initialization_status_; |
- // RTP timestamp increment representing one second. |
- const int rtp_timebase_; |
- |
// This object controls how we change the bitrate to make sure the |
// buffer doesn't overflow. |
scoped_ptr<CongestionControl> congestion_control_; |
private: |
+ // RTP timestamp increment representing one second. |
+ const int rtp_timebase_; |
+ |
const bool is_audio_; |
// Ring buffers to keep track of recent frame timestamps (both in terms of |
@@ -164,8 +166,16 @@ class FrameSender { |
base::TimeTicks frame_reference_times_[256]; |
RtpTimestamp frame_rtp_timestamps_[256]; |
- // The most recently measured round trip time. |
+ // The most recently measured round trip time, and a recent history of |
+ // maximums. |
base::TimeDelta current_round_trip_time_; |
+ std::deque<base::TimeDelta> max_rtt_buckets_; |
+ base::TimeTicks last_max_rtt_bucket_rotation_; |
+ |
+ // The current maximum expected one-way trip time on the network. This is |
+ // re-computed as each RTT measurement is received, and affects the media |
+ // duration allowed to be in-flight. |
+ base::TimeDelta expected_max_one_way_trip_time_; |
// NOTE: Weak pointers must be invalidated before all other member variables. |
base::WeakPtrFactory<FrameSender> weak_factory_; |