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