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

Side by Side Diff: media/cast/sender/video_sender.cc

Issue 863083002: [cast] Add optional VideoEncoder method to flush frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add documentation for VideoConfig::max_number_of_video_buffers_used Created 5 years, 11 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
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 #include "media/cast/sender/video_sender.h" 5 #include "media/cast/sender/video_sender.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 if (ShouldDropNextFrame(duration_added_by_next_frame)) { 180 if (ShouldDropNextFrame(duration_added_by_next_frame)) {
181 base::TimeDelta new_target_delay = std::min( 181 base::TimeDelta new_target_delay = std::min(
182 current_round_trip_time_ * kRoundTripsNeeded + 182 current_round_trip_time_ * kRoundTripsNeeded +
183 base::TimeDelta::FromMilliseconds(kConstantTimeMs), 183 base::TimeDelta::FromMilliseconds(kConstantTimeMs),
184 max_playout_delay_); 184 max_playout_delay_);
185 if (new_target_delay > target_playout_delay_) { 185 if (new_target_delay > target_playout_delay_) {
186 VLOG(1) << "New target delay: " << new_target_delay.InMilliseconds(); 186 VLOG(1) << "New target delay: " << new_target_delay.InMilliseconds();
187 playout_delay_change_cb_.Run(new_target_delay); 187 playout_delay_change_cb_.Run(new_target_delay);
188 } 188 }
189
190 // Some encoder implementations have a frame window for analysis. Since we
191 // are dropping this frame, unless we instruct the encoder to flush all the
192 // frames that have been enqueued for encoding, frames_in_encoder_ and
193 // last_enqueued_frame_reference_time_ will never be updated and we will
194 // drop every subsequent frame for the rest of the session.
195 video_encoder_->EmitFrames();
196
189 return; 197 return;
190 } 198 }
191 199
192 uint32 bitrate = congestion_control_->GetBitrate( 200 uint32 bitrate = congestion_control_->GetBitrate(
193 reference_time + target_playout_delay_, target_playout_delay_); 201 reference_time + target_playout_delay_, target_playout_delay_);
194 if (bitrate != last_bitrate_) { 202 if (bitrate != last_bitrate_) {
195 video_encoder_->SetBitRate(bitrate); 203 video_encoder_->SetBitRate(bitrate);
196 last_bitrate_ = bitrate; 204 last_bitrate_ = bitrate;
197 } 205 }
198 206
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 DCHECK_GE(frames_in_encoder_, 0); 259 DCHECK_GE(frames_in_encoder_, 0);
252 260
253 duration_in_encoder_ = 261 duration_in_encoder_ =
254 last_enqueued_frame_reference_time_ - encoded_frame->reference_time; 262 last_enqueued_frame_reference_time_ - encoded_frame->reference_time;
255 263
256 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); 264 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass());
257 } 265 }
258 266
259 } // namespace cast 267 } // namespace cast
260 } // namespace media 268 } // namespace media
OLDNEW
« media/cast/sender/video_encoder.h ('K') | « media/cast/sender/video_encoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698