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

Side by Side Diff: media/cast/video_sender/video_sender.h

Issue 276783002: Cast: Reduce bitrate drastically when close to unacked frame limit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sign fix Created 6 years, 7 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 | « no previous file | media/cast/video_sender/video_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ 5 #ifndef MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_
6 #define MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ 6 #define MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 void ResendFrame(uint32 resend_frame_id); 95 void ResendFrame(uint32 resend_frame_id);
96 void ReceivedAck(uint32 acked_frame_id); 96 void ReceivedAck(uint32 acked_frame_id);
97 void UpdateFramesInFlight(); 97 void UpdateFramesInFlight();
98 98
99 void SendEncodedVideoFrameMainThread( 99 void SendEncodedVideoFrameMainThread(
100 scoped_ptr<transport::EncodedVideoFrame> encoded_frame, 100 scoped_ptr<transport::EncodedVideoFrame> encoded_frame,
101 const base::TimeTicks& capture_time); 101 const base::TimeTicks& capture_time);
102 102
103 void InitializeTimers(); 103 void InitializeTimers();
104 104
105 void UpdateBitrate(int32 new_bitrate);
106
105 base::TimeDelta rtp_max_delay_; 107 base::TimeDelta rtp_max_delay_;
106 const int max_frame_rate_; 108 const int max_frame_rate_;
107 109
108 scoped_refptr<CastEnvironment> cast_environment_; 110 scoped_refptr<CastEnvironment> cast_environment_;
109 transport::CastTransportSender* const transport_sender_; 111 transport::CastTransportSender* const transport_sender_;
110 112
111 // Subscribes to raw events. 113 // Subscribes to raw events.
112 // Processes raw audio events to be sent over to the cast receiver via RTCP. 114 // Processes raw audio events to be sent over to the cast receiver via RTCP.
113 SenderRtcpEventSubscriber event_subscriber_; 115 SenderRtcpEventSubscriber event_subscriber_;
114 RtpSenderStatistics rtp_stats_; 116 RtpSenderStatistics rtp_stats_;
115 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_; 117 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_;
116 scoped_ptr<VideoEncoder> video_encoder_; 118 scoped_ptr<VideoEncoder> video_encoder_;
117 scoped_ptr<Rtcp> rtcp_; 119 scoped_ptr<Rtcp> rtcp_;
118 uint8 max_unacked_frames_; 120 uint8 max_unacked_frames_;
119 int last_acked_frame_id_; 121 int last_acked_frame_id_;
120 int last_sent_frame_id_; 122 int last_sent_frame_id_;
121 int frames_in_encoder_; 123 int frames_in_encoder_;
122 int duplicate_ack_; 124 int duplicate_ack_;
123 base::TimeTicks last_send_time_; 125 base::TimeTicks last_send_time_;
124 base::TimeTicks last_checked_skip_count_time_; 126 base::TimeTicks last_checked_skip_count_time_;
125 int last_skip_count_; 127 int last_skip_count_;
126 int current_requested_bitrate_; 128 int current_requested_bitrate_;
129 // When we get close to the max number of un-acked frames, we set lower
130 // the bitrate drastically to ensure that we catch up. Without this we
131 // risk getting stuck in a catch-up state forever.
132 int current_bitrate_divider_;
127 CongestionControl congestion_control_; 133 CongestionControl congestion_control_;
128 134
129 // This is a "good enough" mapping for finding the RTP timestamp associated 135 // This is a "good enough" mapping for finding the RTP timestamp associated
130 // with a video frame. The key is the lowest 8 bits of frame id (which is 136 // with a video frame. The key is the lowest 8 bits of frame id (which is
131 // what is sent via RTCP). This map is used for logging purposes. The only 137 // what is sent via RTCP). This map is used for logging purposes. The only
132 // time when this mapping will be incorrect is when it receives an ACK for a 138 // time when this mapping will be incorrect is when it receives an ACK for a
133 // old enough frame such that 8-bit wrap around has already occurred, which 139 // old enough frame such that 8-bit wrap around has already occurred, which
134 // should be pretty rare. 140 // should be pretty rare.
135 RtpTimestamp frame_id_to_rtp_timestamp_[256]; 141 RtpTimestamp frame_id_to_rtp_timestamp_[256];
136 142
137 bool initialized_; 143 bool initialized_;
138 // Indicator for receiver acknowledgments. 144 // Indicator for receiver acknowledgments.
139 bool active_session_; 145 bool active_session_;
140 146
141 // NOTE: Weak pointers must be invalidated before all other member variables. 147 // NOTE: Weak pointers must be invalidated before all other member variables.
142 base::WeakPtrFactory<VideoSender> weak_factory_; 148 base::WeakPtrFactory<VideoSender> weak_factory_;
143 149
144 DISALLOW_COPY_AND_ASSIGN(VideoSender); 150 DISALLOW_COPY_AND_ASSIGN(VideoSender);
145 }; 151 };
146 152
147 } // namespace cast 153 } // namespace cast
148 } // namespace media 154 } // namespace media
149 155
150 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ 156 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_
OLDNEW
« no previous file with comments | « no previous file | media/cast/video_sender/video_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698