| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Record or retrieve a recent history of each frame's timestamps. | 81 // Record or retrieve a recent history of each frame's timestamps. |
| 82 // Warning: If a frame ID too far in the past is requested, the getters will | 82 // Warning: If a frame ID too far in the past is requested, the getters will |
| 83 // silently succeed but return incorrect values. Be sure to respect | 83 // silently succeed but return incorrect values. Be sure to respect |
| 84 // media::cast::kMaxUnackedFrames. | 84 // media::cast::kMaxUnackedFrames. |
| 85 void RecordLatestFrameTimestamps(uint32 frame_id, | 85 void RecordLatestFrameTimestamps(uint32 frame_id, |
| 86 base::TimeTicks reference_time, | 86 base::TimeTicks reference_time, |
| 87 RtpTimestamp rtp_timestamp); | 87 RtpTimestamp rtp_timestamp); |
| 88 base::TimeTicks GetRecordedReferenceTime(uint32 frame_id) const; | 88 base::TimeTicks GetRecordedReferenceTime(uint32 frame_id) const; |
| 89 RtpTimestamp GetRecordedRtpTimestamp(uint32 frame_id) const; | 89 RtpTimestamp GetRecordedRtpTimestamp(uint32 frame_id) const; |
| 90 | 90 |
| 91 // Returns true if there are too many frames in flight, or if the media |
| 92 // duration of the frames in flight would be too high by sending the next |
| 93 // frame. The latter metric is determined from the given |capture_time| |
| 94 // for the next frame to be encoded and sent. |
| 95 bool ShouldDropNextFrame(base::TimeTicks capture_time) const; |
| 96 |
| 91 const base::TimeDelta rtcp_interval_; | 97 const base::TimeDelta rtcp_interval_; |
| 92 | 98 |
| 93 // The total amount of time between a frame's capture/recording on the sender | 99 // The total amount of time between a frame's capture/recording on the sender |
| 94 // and its playback on the receiver (i.e., shown to a user). This is fixed as | 100 // and its playback on the receiver (i.e., shown to a user). This is fixed as |
| 95 // a value large enough to give the system sufficient time to encode, | 101 // a value large enough to give the system sufficient time to encode, |
| 96 // transmit/retransmit, receive, decode, and render; given its run-time | 102 // transmit/retransmit, receive, decode, and render; given its run-time |
| 97 // environment (sender/receiver hardware performance, network conditions, | 103 // environment (sender/receiver hardware performance, network conditions, |
| 98 // etc.). | 104 // etc.). |
| 99 base::TimeDelta target_playout_delay_; | 105 base::TimeDelta target_playout_delay_; |
| 100 | 106 |
| 101 // If true, we transmit the target playout delay to the receiver. | 107 // If true, we transmit the target playout delay to the receiver. |
| 102 bool send_target_playout_delay_; | 108 bool send_target_playout_delay_; |
| 103 | 109 |
| 104 // Max encoded frames generated per second. | 110 // Max encoded frames generated per second. |
| 105 double max_frame_rate_; | 111 double max_frame_rate_; |
| 106 | 112 |
| 107 // Maximum number of outstanding frames before the encoding and sending of | 113 // Maximum number of outstanding frames before the encoding and sending of |
| 108 // new frames shall halt. | 114 // new frames shall halt. |
| 109 int max_unacked_frames_; | 115 int max_unacked_frames_; |
| 110 | 116 |
| 117 // The number of frames queued for encoding, but not yet sent. |
| 118 int frames_in_encoder_; |
| 119 |
| 111 // Counts how many RTCP reports are being "aggressively" sent (i.e., one per | 120 // Counts how many RTCP reports are being "aggressively" sent (i.e., one per |
| 112 // frame) at the start of the session. Once a threshold is reached, RTCP | 121 // frame) at the start of the session. Once a threshold is reached, RTCP |
| 113 // reports are instead sent at the configured interval + random drift. | 122 // reports are instead sent at the configured interval + random drift. |
| 114 int num_aggressive_rtcp_reports_sent_; | 123 int num_aggressive_rtcp_reports_sent_; |
| 115 | 124 |
| 116 // This is "null" until the first frame is sent. Thereafter, this tracks the | 125 // This is "null" until the first frame is sent. Thereafter, this tracks the |
| 117 // last time any frame was sent or re-sent. | 126 // last time any frame was sent or re-sent. |
| 118 base::TimeTicks last_send_time_; | 127 base::TimeTicks last_send_time_; |
| 119 | 128 |
| 120 // The ID of the last frame sent. Logic throughout FrameSender assumes this | 129 // The ID of the last frame sent. Logic throughout FrameSender assumes this |
| (...skipping 29 matching lines...) Expand all Loading... |
| 150 // NOTE: Weak pointers must be invalidated before all other member variables. | 159 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 151 base::WeakPtrFactory<FrameSender> weak_factory_; | 160 base::WeakPtrFactory<FrameSender> weak_factory_; |
| 152 | 161 |
| 153 DISALLOW_COPY_AND_ASSIGN(FrameSender); | 162 DISALLOW_COPY_AND_ASSIGN(FrameSender); |
| 154 }; | 163 }; |
| 155 | 164 |
| 156 } // namespace cast | 165 } // namespace cast |
| 157 } // namespace media | 166 } // namespace media |
| 158 | 167 |
| 159 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ | 168 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ |
| OLD | NEW |