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

Side by Side Diff: media/cast/sender/frame_sender.h

Issue 562653004: Cast: First stab at implementing adaptive latency (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: refine formula, add comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This is the base class for an object that send frames to a receiver. 5 // This is the base class for an object that send frames to a receiver.
6 // TODO(hclam): Refactor such that there is no separate AudioSender vs. 6 // TODO(hclam): Refactor such that there is no separate AudioSender vs.
7 // VideoSender, and the functionality of both is rolled into this class. 7 // VideoSender, and the functionality of both is rolled into this class.
8 8
9 #ifndef MEDIA_CAST_SENDER_FRAME_SENDER_H_ 9 #ifndef MEDIA_CAST_SENDER_FRAME_SENDER_H_
10 #define MEDIA_CAST_SENDER_FRAME_SENDER_H_ 10 #define MEDIA_CAST_SENDER_FRAME_SENDER_H_
(...skipping 11 matching lines...) Expand all
22 22
23 class FrameSender { 23 class FrameSender {
24 public: 24 public:
25 FrameSender(scoped_refptr<CastEnvironment> cast_environment, 25 FrameSender(scoped_refptr<CastEnvironment> cast_environment,
26 bool is_audio, 26 bool is_audio,
27 CastTransportSender* const transport_sender, 27 CastTransportSender* const transport_sender,
28 base::TimeDelta rtcp_interval, 28 base::TimeDelta rtcp_interval,
29 int rtp_timebase, 29 int rtp_timebase,
30 uint32 ssrc, 30 uint32 ssrc,
31 double max_frame_rate, 31 double max_frame_rate,
32 base::TimeDelta playout_delay, 32 base::TimeDelta min_playout_delay,
33 base::TimeDelta max_playout_delay,
33 CongestionControl* congestion_control); 34 CongestionControl* congestion_control);
34 virtual ~FrameSender(); 35 virtual ~FrameSender();
35 36
36 // Calling this function is only valid if the receiver supports the 37 // Calling this function is only valid if the receiver supports the
37 // "extra_playout_delay", rtp extension. 38 // "extra_playout_delay", rtp extension.
38 void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay); 39 void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay);
39 40
40 base::TimeDelta GetTargetPlayoutDelay() const { 41 base::TimeDelta GetTargetPlayoutDelay() const {
41 return target_playout_delay_; 42 return target_playout_delay_;
42 } 43 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 102
102 const base::TimeDelta rtcp_interval_; 103 const base::TimeDelta rtcp_interval_;
103 104
104 // The total amount of time between a frame's capture/recording on the sender 105 // The total amount of time between a frame's capture/recording on the sender
105 // and its playback on the receiver (i.e., shown to a user). This is fixed as 106 // and its playback on the receiver (i.e., shown to a user). This is fixed as
106 // a value large enough to give the system sufficient time to encode, 107 // a value large enough to give the system sufficient time to encode,
107 // transmit/retransmit, receive, decode, and render; given its run-time 108 // transmit/retransmit, receive, decode, and render; given its run-time
108 // environment (sender/receiver hardware performance, network conditions, 109 // environment (sender/receiver hardware performance, network conditions,
109 // etc.). 110 // etc.).
110 base::TimeDelta target_playout_delay_; 111 base::TimeDelta target_playout_delay_;
112 base::TimeDelta min_playout_delay_;
113 base::TimeDelta max_playout_delay_;
111 114
112 // If true, we transmit the target playout delay to the receiver. 115 // If true, we transmit the target playout delay to the receiver.
113 bool send_target_playout_delay_; 116 bool send_target_playout_delay_;
114 117
115 // Max encoded frames generated per second. 118 // Max encoded frames generated per second.
116 double max_frame_rate_; 119 double max_frame_rate_;
117 120
118 // Maximum number of outstanding frames before the encoding and sending of 121 // Maximum number of outstanding frames before the encoding and sending of
119 // new frames shall halt. 122 // new frames shall halt.
120 int max_unacked_frames_; 123 int max_unacked_frames_;
(...skipping 27 matching lines...) Expand all
148 // STATUS_VIDEO_INITIALIZED. 151 // STATUS_VIDEO_INITIALIZED.
149 CastInitializationStatus cast_initialization_status_; 152 CastInitializationStatus cast_initialization_status_;
150 153
151 // RTP timestamp increment representing one second. 154 // RTP timestamp increment representing one second.
152 const int rtp_timebase_; 155 const int rtp_timebase_;
153 156
154 // This object controls how we change the bitrate to make sure the 157 // This object controls how we change the bitrate to make sure the
155 // buffer doesn't overflow. 158 // buffer doesn't overflow.
156 scoped_ptr<CongestionControl> congestion_control_; 159 scoped_ptr<CongestionControl> congestion_control_;
157 160
161 // The most recently measured round trip time.
162 base::TimeDelta current_round_trip_time_;
163
158 private: 164 private:
159 const bool is_audio_; 165 const bool is_audio_;
160 166
161 // Ring buffers to keep track of recent frame timestamps (both in terms of 167 // Ring buffers to keep track of recent frame timestamps (both in terms of
162 // local reference time and RTP media time). These should only be accessed 168 // local reference time and RTP media time). These should only be accessed
163 // through the Record/GetXXX() methods. 169 // through the Record/GetXXX() methods.
164 base::TimeTicks frame_reference_times_[256]; 170 base::TimeTicks frame_reference_times_[256];
165 RtpTimestamp frame_rtp_timestamps_[256]; 171 RtpTimestamp frame_rtp_timestamps_[256];
166 172
167 // The most recently measured round trip time.
168 base::TimeDelta current_round_trip_time_;
169
170 // NOTE: Weak pointers must be invalidated before all other member variables. 173 // NOTE: Weak pointers must be invalidated before all other member variables.
171 base::WeakPtrFactory<FrameSender> weak_factory_; 174 base::WeakPtrFactory<FrameSender> weak_factory_;
172 175
173 DISALLOW_COPY_AND_ASSIGN(FrameSender); 176 DISALLOW_COPY_AND_ASSIGN(FrameSender);
174 }; 177 };
175 178
176 } // namespace cast 179 } // namespace cast
177 } // namespace media 180 } // namespace media
178 181
179 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ 182 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698