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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // Calling this function is only valid if the receiver supports the | 44 // Calling this function is only valid if the receiver supports the |
45 // "extra_playout_delay", rtp extension. | 45 // "extra_playout_delay", rtp extension. |
46 void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay); | 46 void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay); |
47 | 47 |
48 base::TimeDelta GetTargetPlayoutDelay() const { | 48 base::TimeDelta GetTargetPlayoutDelay() const { |
49 return target_playout_delay_; | 49 return target_playout_delay_; |
50 } | 50 } |
51 | 51 |
52 // Called by the encoder with the next EncodeFrame to send. | 52 // Called by the encoder with the next EncodeFrame to send. |
53 void SendEncodedFrame(int requested_bitrate_before_encode, | 53 void SendEncodedFrame(int requested_bitrate_before_encode, |
54 scoped_ptr<SenderEncodedFrame> encoded_frame); | 54 std::unique_ptr<SenderEncodedFrame> encoded_frame); |
55 | 55 |
56 protected: | 56 protected: |
57 // Returns the number of frames in the encoder's backlog. | 57 // Returns the number of frames in the encoder's backlog. |
58 virtual int GetNumberOfFramesInEncoder() const = 0; | 58 virtual int GetNumberOfFramesInEncoder() const = 0; |
59 | 59 |
60 // Returns the duration of the data in the encoder's backlog plus the duration | 60 // Returns the duration of the data in the encoder's backlog plus the duration |
61 // of sent, unacknowledged frames. | 61 // of sent, unacknowledged frames. |
62 virtual base::TimeDelta GetInFlightMediaDuration() const = 0; | 62 virtual base::TimeDelta GetInFlightMediaDuration() const = 0; |
63 | 63 |
64 protected: | 64 protected: |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 uint32_t latest_acked_frame_id_; | 157 uint32_t latest_acked_frame_id_; |
158 | 158 |
159 // Counts the number of duplicate ACK that are being received. When this | 159 // Counts the number of duplicate ACK that are being received. When this |
160 // number reaches a threshold, the sender will take this as a sign that the | 160 // number reaches a threshold, the sender will take this as a sign that the |
161 // receiver hasn't yet received the first packet of the next frame. In this | 161 // receiver hasn't yet received the first packet of the next frame. In this |
162 // case, VideoSender will trigger a re-send of the next frame. | 162 // case, VideoSender will trigger a re-send of the next frame. |
163 int duplicate_ack_counter_; | 163 int duplicate_ack_counter_; |
164 | 164 |
165 // This object controls how we change the bitrate to make sure the | 165 // This object controls how we change the bitrate to make sure the |
166 // buffer doesn't overflow. | 166 // buffer doesn't overflow. |
167 scoped_ptr<CongestionControl> congestion_control_; | 167 std::unique_ptr<CongestionControl> congestion_control_; |
168 | 168 |
169 // The most recently measured round trip time. | 169 // The most recently measured round trip time. |
170 base::TimeDelta current_round_trip_time_; | 170 base::TimeDelta current_round_trip_time_; |
171 | 171 |
172 // This flag is set true when a Pli message is received. It is cleared once | 172 // This flag is set true when a Pli message is received. It is cleared once |
173 // the FrameSender scheduled an encoded key frame to be sent. | 173 // the FrameSender scheduled an encoded key frame to be sent. |
174 bool picture_lost_at_receiver_; | 174 bool picture_lost_at_receiver_; |
175 | 175 |
176 private: | 176 private: |
177 // Returns the maximum media duration currently allowed in-flight. This | 177 // Returns the maximum media duration currently allowed in-flight. This |
(...skipping 14 matching lines...) Expand all Loading... |
192 // NOTE: Weak pointers must be invalidated before all other member variables. | 192 // NOTE: Weak pointers must be invalidated before all other member variables. |
193 base::WeakPtrFactory<FrameSender> weak_factory_; | 193 base::WeakPtrFactory<FrameSender> weak_factory_; |
194 | 194 |
195 DISALLOW_COPY_AND_ASSIGN(FrameSender); | 195 DISALLOW_COPY_AND_ASSIGN(FrameSender); |
196 }; | 196 }; |
197 | 197 |
198 } // namespace cast | 198 } // namespace cast |
199 } // namespace media | 199 } // namespace media |
200 | 200 |
201 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ | 201 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ |
OLD | NEW |