OLD | NEW |
---|---|
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 14 matching lines...) Expand all Loading... | |
25 class FrameSender { | 25 class FrameSender { |
26 public: | 26 public: |
27 FrameSender(scoped_refptr<CastEnvironment> cast_environment, | 27 FrameSender(scoped_refptr<CastEnvironment> cast_environment, |
28 bool is_audio, | 28 bool is_audio, |
29 CastTransportSender* const transport_sender, | 29 CastTransportSender* const transport_sender, |
30 int rtp_timebase, | 30 int rtp_timebase, |
31 uint32 ssrc, | 31 uint32 ssrc, |
32 double max_frame_rate, | 32 double max_frame_rate, |
33 base::TimeDelta min_playout_delay, | 33 base::TimeDelta min_playout_delay, |
34 base::TimeDelta max_playout_delay, | 34 base::TimeDelta max_playout_delay, |
35 base::TimeDelta animated_playout_delay, | |
35 CongestionControl* congestion_control); | 36 CongestionControl* congestion_control); |
36 virtual ~FrameSender(); | 37 virtual ~FrameSender(); |
37 | 38 |
38 int rtp_timebase() const { return rtp_timebase_; } | 39 int rtp_timebase() const { return rtp_timebase_; } |
39 | 40 |
40 // Calling this function is only valid if the receiver supports the | 41 // Calling this function is only valid if the receiver supports the |
41 // "extra_playout_delay", rtp extension. | 42 // "extra_playout_delay", rtp extension. |
42 void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay); | 43 void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay); |
43 | 44 |
44 base::TimeDelta GetTargetPlayoutDelay() const { | 45 base::TimeDelta GetTargetPlayoutDelay() const { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 // media::cast::kMaxUnackedFrames. | 99 // media::cast::kMaxUnackedFrames. |
99 void RecordLatestFrameTimestamps(uint32 frame_id, | 100 void RecordLatestFrameTimestamps(uint32 frame_id, |
100 base::TimeTicks reference_time, | 101 base::TimeTicks reference_time, |
101 RtpTimestamp rtp_timestamp); | 102 RtpTimestamp rtp_timestamp); |
102 base::TimeTicks GetRecordedReferenceTime(uint32 frame_id) const; | 103 base::TimeTicks GetRecordedReferenceTime(uint32 frame_id) const; |
103 RtpTimestamp GetRecordedRtpTimestamp(uint32 frame_id) const; | 104 RtpTimestamp GetRecordedRtpTimestamp(uint32 frame_id) const; |
104 | 105 |
105 // Returns the number of frames that were sent but not yet acknowledged. | 106 // Returns the number of frames that were sent but not yet acknowledged. |
106 int GetUnacknowledgedFrameCount() const; | 107 int GetUnacknowledgedFrameCount() const; |
107 | 108 |
108 // The total amount of time between a frame's capture/recording on the sender | 109 // Playout delay represents total amount of time between a frame's |
109 // and its playback on the receiver (i.e., shown to a user). This is fixed as | 110 // capture/recording on the sender and its playback on the receiver |
110 // a value large enough to give the system sufficient time to encode, | 111 // (i.e., shown to a user). This should be a value large enough to |
111 // transmit/retransmit, receive, decode, and render; given its run-time | 112 // give the system sufficient time to encode, transmit/retransmit, |
112 // environment (sender/receiver hardware performance, network conditions, | 113 // receive, decode, and render; given its run-time environment |
113 // etc.). | 114 // (sender/receiver hardware performance, network conditions,etc.). |
115 | |
116 // The |target_playout delay_| is the current delay that is adaptively | |
miu
2015/12/03 21:26:23
Nice comment! :)
| |
117 // adjusted based on feedback from video capture engine and the congestion | |
118 // control. In case of interactive content, the target is adjusted to start | |
119 // at |min_playout_delay_| and in case of animated content, it starts out at | |
120 // |animated_playout_delay_| and then adaptively adjust based on feedback | |
121 // from congestion control. | |
114 base::TimeDelta target_playout_delay_; | 122 base::TimeDelta target_playout_delay_; |
115 base::TimeDelta min_playout_delay_; | 123 base::TimeDelta min_playout_delay_; |
miu
2015/12/03 21:26:23
nit: Looks like min/max/animated_playout_delay_ co
Irfan
2015/12/04 22:45:37
Done.
| |
116 base::TimeDelta max_playout_delay_; | 124 base::TimeDelta max_playout_delay_; |
125 // Starting playout delay for animated content. | |
126 base::TimeDelta animated_playout_delay_; | |
117 | 127 |
118 // If true, we transmit the target playout delay to the receiver. | 128 // If true, we transmit the target playout delay to the receiver. |
119 bool send_target_playout_delay_; | 129 bool send_target_playout_delay_; |
120 | 130 |
121 // Max encoded frames generated per second. | 131 // Max encoded frames generated per second. |
122 double max_frame_rate_; | 132 double max_frame_rate_; |
123 | 133 |
124 // Counts how many RTCP reports are being "aggressively" sent (i.e., one per | 134 // Counts how many RTCP reports are being "aggressively" sent (i.e., one per |
125 // frame) at the start of the session. Once a threshold is reached, RTCP | 135 // frame) at the start of the session. Once a threshold is reached, RTCP |
126 // reports are instead sent at the configured interval + random drift. | 136 // reports are instead sent at the configured interval + random drift. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 // NOTE: Weak pointers must be invalidated before all other member variables. | 182 // NOTE: Weak pointers must be invalidated before all other member variables. |
173 base::WeakPtrFactory<FrameSender> weak_factory_; | 183 base::WeakPtrFactory<FrameSender> weak_factory_; |
174 | 184 |
175 DISALLOW_COPY_AND_ASSIGN(FrameSender); | 185 DISALLOW_COPY_AND_ASSIGN(FrameSender); |
176 }; | 186 }; |
177 | 187 |
178 } // namespace cast | 188 } // namespace cast |
179 } // namespace media | 189 } // namespace media |
180 | 190 |
181 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ | 191 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ |
OLD | NEW |