| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // Returns true if too many frames would be in-flight by encoding and sending | 93 // Returns true if too many frames would be in-flight by encoding and sending |
| 94 // the next frame having the given |frame_duration|. | 94 // the next frame having the given |frame_duration|. |
| 95 bool ShouldDropNextFrame(base::TimeDelta frame_duration) const; | 95 bool ShouldDropNextFrame(base::TimeDelta frame_duration) const; |
| 96 | 96 |
| 97 // Record or retrieve a recent history of each frame's timestamps. | 97 // Record or retrieve a recent history of each frame's timestamps. |
| 98 // Warning: If a frame ID too far in the past is requested, the getters will | 98 // Warning: If a frame ID too far in the past is requested, the getters will |
| 99 // silently succeed but return incorrect values. Be sure to respect | 99 // silently succeed but return incorrect values. Be sure to respect |
| 100 // media::cast::kMaxUnackedFrames. | 100 // media::cast::kMaxUnackedFrames. |
| 101 void RecordLatestFrameTimestamps(uint32_t frame_id, | 101 void RecordLatestFrameTimestamps(uint32_t frame_id, |
| 102 base::TimeTicks reference_time, | 102 base::TimeTicks reference_time, |
| 103 RtpTimestamp rtp_timestamp); | 103 RtpTimeTicks rtp_timestamp); |
| 104 base::TimeTicks GetRecordedReferenceTime(uint32_t frame_id) const; | 104 base::TimeTicks GetRecordedReferenceTime(uint32_t frame_id) const; |
| 105 RtpTimestamp GetRecordedRtpTimestamp(uint32_t frame_id) const; | 105 RtpTimeTicks GetRecordedRtpTimestamp(uint32_t frame_id) const; |
| 106 | 106 |
| 107 // Returns the number of frames that were sent but not yet acknowledged. | 107 // Returns the number of frames that were sent but not yet acknowledged. |
| 108 int GetUnacknowledgedFrameCount() const; | 108 int GetUnacknowledgedFrameCount() const; |
| 109 | 109 |
| 110 // The total amount of time between a frame's capture/recording on the sender | 110 // The total amount of time between a frame's capture/recording on the sender |
| 111 // and its playback on the receiver (i.e., shown to a user). This is fixed as | 111 // and its playback on the receiver (i.e., shown to a user). This is fixed as |
| 112 // a value large enough to give the system sufficient time to encode, | 112 // a value large enough to give the system sufficient time to encode, |
| 113 // transmit/retransmit, receive, decode, and render; given its run-time | 113 // transmit/retransmit, receive, decode, and render; given its run-time |
| 114 // environment (sender/receiver hardware performance, network conditions, | 114 // environment (sender/receiver hardware performance, network conditions, |
| 115 // etc.). | 115 // etc.). |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 // RTP timestamp increment representing one second. | 163 // RTP timestamp increment representing one second. |
| 164 const int rtp_timebase_; | 164 const int rtp_timebase_; |
| 165 | 165 |
| 166 const bool is_audio_; | 166 const bool is_audio_; |
| 167 | 167 |
| 168 // Ring buffers to keep track of recent frame timestamps (both in terms of | 168 // Ring buffers to keep track of recent frame timestamps (both in terms of |
| 169 // local reference time and RTP media time). These should only be accessed | 169 // local reference time and RTP media time). These should only be accessed |
| 170 // through the Record/GetXXX() methods. | 170 // through the Record/GetXXX() methods. |
| 171 base::TimeTicks frame_reference_times_[256]; | 171 base::TimeTicks frame_reference_times_[256]; |
| 172 RtpTimestamp frame_rtp_timestamps_[256]; | 172 RtpTimeTicks frame_rtp_timestamps_[256]; |
| 173 | 173 |
| 174 // NOTE: Weak pointers must be invalidated before all other member variables. | 174 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 175 base::WeakPtrFactory<FrameSender> weak_factory_; | 175 base::WeakPtrFactory<FrameSender> weak_factory_; |
| 176 | 176 |
| 177 DISALLOW_COPY_AND_ASSIGN(FrameSender); | 177 DISALLOW_COPY_AND_ASSIGN(FrameSender); |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 } // namespace cast | 180 } // namespace cast |
| 181 } // namespace media | 181 } // namespace media |
| 182 | 182 |
| 183 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ | 183 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ |
| OLD | NEW |