Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: media/cast/sender/frame_sender.h

Issue 532373003: [Cast] RTT clean-up to the max! (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove RTT accessors in FrameSender (not needed post-refactor). Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/cast/sender/audio_sender.cc ('k') | media/cast/sender/frame_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // Called by the encoder with the next EncodeFrame to send. 44 // Called by the encoder with the next EncodeFrame to send.
45 void SendEncodedFrame(int requested_bitrate_before_encode, 45 void SendEncodedFrame(int requested_bitrate_before_encode,
46 scoped_ptr<EncodedFrame> encoded_frame); 46 scoped_ptr<EncodedFrame> encoded_frame);
47 47
48 protected: 48 protected:
49 // Schedule and execute periodic sending of RTCP report. 49 // Schedule and execute periodic sending of RTCP report.
50 void ScheduleNextRtcpReport(); 50 void ScheduleNextRtcpReport();
51 void SendRtcpReport(bool schedule_future_reports); 51 void SendRtcpReport(bool schedule_future_reports);
52 52
53 void OnReceivedRtt(base::TimeDelta rtt, 53 void OnMeasuredRoundTripTime(base::TimeDelta rtt);
54 base::TimeDelta avg_rtt,
55 base::TimeDelta min_rtt,
56 base::TimeDelta max_rtt);
57
58 bool is_rtt_available() const { return rtt_available_; }
59 54
60 const scoped_refptr<CastEnvironment> cast_environment_; 55 const scoped_refptr<CastEnvironment> cast_environment_;
61 56
62 // Sends encoded frames over the configured transport (e.g., UDP). In 57 // Sends encoded frames over the configured transport (e.g., UDP). In
63 // Chromium, this could be a proxy that first sends the frames from a renderer 58 // Chromium, this could be a proxy that first sends the frames from a renderer
64 // process to the browser process over IPC, with the browser process being 59 // process to the browser process over IPC, with the browser process being
65 // responsible for "packetizing" the frames and pushing packets into the 60 // responsible for "packetizing" the frames and pushing packets into the
66 // network layer. 61 // network layer.
67 CastTransportSender* const transport_sender_; 62 CastTransportSender* const transport_sender_;
68 63
69 const uint32 ssrc_; 64 const uint32 ssrc_;
70 65
71 // RTT information from RTCP.
72 bool rtt_available_;
73 base::TimeDelta rtt_;
74 base::TimeDelta avg_rtt_;
75 base::TimeDelta min_rtt_;
76 base::TimeDelta max_rtt_;
77
78 protected: 66 protected:
79 // Schedule and execute periodic checks for re-sending packets. If no 67 // Schedule and execute periodic checks for re-sending packets. If no
80 // acknowledgements have been received for "too long," AudioSender will 68 // acknowledgements have been received for "too long," AudioSender will
81 // speculatively re-send certain packets of an unacked frame to kick-start 69 // speculatively re-send certain packets of an unacked frame to kick-start
82 // re-transmission. This is a last resort tactic to prevent the session from 70 // re-transmission. This is a last resort tactic to prevent the session from
83 // getting stuck after a long outage. 71 // getting stuck after a long outage.
84 void ScheduleNextResendCheck(); 72 void ScheduleNextResendCheck();
85 void ResendCheck(); 73 void ResendCheck();
86 void ResendForKickstart(); 74 void ResendForKickstart();
87 75
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 156
169 private: 157 private:
170 const bool is_audio_; 158 const bool is_audio_;
171 159
172 // Ring buffers to keep track of recent frame timestamps (both in terms of 160 // Ring buffers to keep track of recent frame timestamps (both in terms of
173 // local reference time and RTP media time). These should only be accessed 161 // local reference time and RTP media time). These should only be accessed
174 // through the Record/GetXXX() methods. 162 // through the Record/GetXXX() methods.
175 base::TimeTicks frame_reference_times_[256]; 163 base::TimeTicks frame_reference_times_[256];
176 RtpTimestamp frame_rtp_timestamps_[256]; 164 RtpTimestamp frame_rtp_timestamps_[256];
177 165
166 // The most recently measured round trip time.
167 base::TimeDelta current_round_trip_time_;
168
178 // NOTE: Weak pointers must be invalidated before all other member variables. 169 // NOTE: Weak pointers must be invalidated before all other member variables.
179 base::WeakPtrFactory<FrameSender> weak_factory_; 170 base::WeakPtrFactory<FrameSender> weak_factory_;
180 171
181 DISALLOW_COPY_AND_ASSIGN(FrameSender); 172 DISALLOW_COPY_AND_ASSIGN(FrameSender);
182 }; 173 };
183 174
184 } // namespace cast 175 } // namespace cast
185 } // namespace media 176 } // namespace media
186 177
187 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ 178 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_
OLDNEW
« no previous file with comments | « media/cast/sender/audio_sender.cc ('k') | media/cast/sender/frame_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698