Chromium Code Reviews| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 // speculatively re-send certain packets of an unacked frame to kick-start | 85 // speculatively re-send certain packets of an unacked frame to kick-start |
| 86 // re-transmission. This is a last resort tactic to prevent the session from | 86 // re-transmission. This is a last resort tactic to prevent the session from |
| 87 // getting stuck after a long outage. | 87 // getting stuck after a long outage. |
| 88 void ScheduleNextResendCheck(); | 88 void ScheduleNextResendCheck(); |
| 89 void ResendCheck(); | 89 void ResendCheck(); |
| 90 void ResendForKickstart(); | 90 void ResendForKickstart(); |
| 91 | 91 |
| 92 // Protected for testability. | 92 // Protected for testability. |
| 93 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); | 93 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); |
| 94 | 94 |
| 95 // Receiving PLI (picture loss indicator) from the receiver. | |
|
miu
2016/02/26 23:36:07
s/Receiving/Called when receiving a/
xjz
2016/02/27 05:53:32
Done.
| |
| 96 void OnReceivedPli(); | |
| 97 | |
| 95 // Returns true if too many frames would be in-flight by encoding and sending | 98 // Returns true if too many frames would be in-flight by encoding and sending |
| 96 // the next frame having the given |frame_duration|. | 99 // the next frame having the given |frame_duration|. |
| 97 bool ShouldDropNextFrame(base::TimeDelta frame_duration) const; | 100 bool ShouldDropNextFrame(base::TimeDelta frame_duration) const; |
| 98 | 101 |
| 99 // Record or retrieve a recent history of each frame's timestamps. | 102 // Record or retrieve a recent history of each frame's timestamps. |
| 100 // Warning: If a frame ID too far in the past is requested, the getters will | 103 // Warning: If a frame ID too far in the past is requested, the getters will |
| 101 // silently succeed but return incorrect values. Be sure to respect | 104 // silently succeed but return incorrect values. Be sure to respect |
| 102 // media::cast::kMaxUnackedFrames. | 105 // media::cast::kMaxUnackedFrames. |
| 103 void RecordLatestFrameTimestamps(uint32_t frame_id, | 106 void RecordLatestFrameTimestamps(uint32_t frame_id, |
| 104 base::TimeTicks reference_time, | 107 base::TimeTicks reference_time, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 // case, VideoSender will trigger a re-send of the next frame. | 162 // case, VideoSender will trigger a re-send of the next frame. |
| 160 int duplicate_ack_counter_; | 163 int duplicate_ack_counter_; |
| 161 | 164 |
| 162 // 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 |
| 163 // buffer doesn't overflow. | 166 // buffer doesn't overflow. |
| 164 scoped_ptr<CongestionControl> congestion_control_; | 167 scoped_ptr<CongestionControl> congestion_control_; |
| 165 | 168 |
| 166 // The most recently measured round trip time. | 169 // The most recently measured round trip time. |
| 167 base::TimeDelta current_round_trip_time_; | 170 base::TimeDelta current_round_trip_time_; |
| 168 | 171 |
| 172 bool picture_lost_at_receiver_; | |
|
miu
2016/02/26 23:36:07
Need comment. Explain when it is set and when it
xjz
2016/02/27 05:53:32
Done.
| |
| 173 | |
| 169 private: | 174 private: |
| 170 // Returns the maximum media duration currently allowed in-flight. This | 175 // Returns the maximum media duration currently allowed in-flight. This |
| 171 // fluctuates in response to the currently-measured network latency. | 176 // fluctuates in response to the currently-measured network latency. |
| 172 base::TimeDelta GetAllowedInFlightMediaDuration() const; | 177 base::TimeDelta GetAllowedInFlightMediaDuration() const; |
| 173 | 178 |
| 174 // RTP timestamp increment representing one second. | 179 // RTP timestamp increment representing one second. |
| 175 const int rtp_timebase_; | 180 const int rtp_timebase_; |
| 176 | 181 |
| 177 const bool is_audio_; | 182 const bool is_audio_; |
| 178 | 183 |
| 179 // Ring buffers to keep track of recent frame timestamps (both in terms of | 184 // Ring buffers to keep track of recent frame timestamps (both in terms of |
| 180 // local reference time and RTP media time). These should only be accessed | 185 // local reference time and RTP media time). These should only be accessed |
| 181 // through the Record/GetXXX() methods. | 186 // through the Record/GetXXX() methods. |
| 182 base::TimeTicks frame_reference_times_[256]; | 187 base::TimeTicks frame_reference_times_[256]; |
| 183 RtpTimeTicks frame_rtp_timestamps_[256]; | 188 RtpTimeTicks frame_rtp_timestamps_[256]; |
| 184 | 189 |
| 185 // NOTE: Weak pointers must be invalidated before all other member variables. | 190 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 186 base::WeakPtrFactory<FrameSender> weak_factory_; | 191 base::WeakPtrFactory<FrameSender> weak_factory_; |
| 187 | 192 |
| 188 DISALLOW_COPY_AND_ASSIGN(FrameSender); | 193 DISALLOW_COPY_AND_ASSIGN(FrameSender); |
| 189 }; | 194 }; |
| 190 | 195 |
| 191 } // namespace cast | 196 } // namespace cast |
| 192 } // namespace media | 197 } // namespace media |
| 193 | 198 |
| 194 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ | 199 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ |
| OLD | NEW |