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

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

Issue 629493004: [Cast] Clean-up: Move max_unacked_frames into CongestionControl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 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/video_encoder_impl_unittest.cc ('k') | media/cast/sender/vp8_encoder.h » ('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 #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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 : FrameSender( 49 : FrameSender(
50 cast_environment, 50 cast_environment,
51 false, 51 false,
52 transport_sender, 52 transport_sender,
53 base::TimeDelta::FromMilliseconds(video_config.rtcp_interval), 53 base::TimeDelta::FromMilliseconds(video_config.rtcp_interval),
54 kVideoFrequency, 54 kVideoFrequency,
55 video_config.ssrc, 55 video_config.ssrc,
56 video_config.max_frame_rate, 56 video_config.max_frame_rate,
57 video_config.min_playout_delay, 57 video_config.min_playout_delay,
58 video_config.max_playout_delay, 58 video_config.max_playout_delay,
59 NewFixedCongestionControl( 59 video_config.use_external_encoder ?
60 (video_config.min_bitrate + video_config.max_bitrate) / 2)), 60 NewFixedCongestionControl(
61 (video_config.min_bitrate + video_config.max_bitrate) / 2) :
62 NewAdaptiveCongestionControl(cast_environment->Clock(),
63 video_config.max_bitrate,
64 video_config.min_bitrate,
65 video_config.max_frame_rate)),
61 frames_in_encoder_(0), 66 frames_in_encoder_(0),
62 last_bitrate_(0), 67 last_bitrate_(0),
63 playout_delay_change_cb_(playout_delay_change_cb), 68 playout_delay_change_cb_(playout_delay_change_cb),
64 weak_factory_(this) { 69 weak_factory_(this) {
65 cast_initialization_status_ = STATUS_VIDEO_UNINITIALIZED; 70 cast_initialization_status_ = STATUS_VIDEO_UNINITIALIZED;
66 VLOG(1) << "max_unacked_frames is " << max_unacked_frames_
67 << " for target_playout_delay="
68 << target_playout_delay_.InMilliseconds() << " ms"
69 << " and max_frame_rate=" << video_config.max_frame_rate;
70 DCHECK_GT(max_unacked_frames_, 0);
71 71
72 if (video_config.use_external_encoder) { 72 if (video_config.use_external_encoder) {
73 video_encoder_.reset(new ExternalVideoEncoder( 73 video_encoder_.reset(new ExternalVideoEncoder(
74 cast_environment, 74 cast_environment,
75 video_config, 75 video_config,
76 base::Bind(&VideoSender::OnEncoderInitialized, 76 base::Bind(&VideoSender::OnEncoderInitialized,
77 weak_factory_.GetWeakPtr(), initialization_cb), 77 weak_factory_.GetWeakPtr(), initialization_cb),
78 create_vea_cb, 78 create_vea_cb,
79 create_video_encode_mem_cb)); 79 create_video_encode_mem_cb));
80 } else { 80 } else {
81 // Software encoder is initialized immediately. 81 // Software encoder is initialized immediately.
82 congestion_control_.reset( 82 video_encoder_.reset(new VideoEncoderImpl(cast_environment, video_config));
83 NewAdaptiveCongestionControl(cast_environment->Clock(),
84 video_config.max_bitrate,
85 video_config.min_bitrate,
86 max_unacked_frames_));
87 video_encoder_.reset(new VideoEncoderImpl(
88 cast_environment, video_config, max_unacked_frames_));
89 cast_initialization_status_ = STATUS_VIDEO_INITIALIZED; 83 cast_initialization_status_ = STATUS_VIDEO_INITIALIZED;
90 } 84 }
91 85
92 if (cast_initialization_status_ == STATUS_VIDEO_INITIALIZED) { 86 if (cast_initialization_status_ == STATUS_VIDEO_INITIALIZED) {
93 cast_environment->PostTask( 87 cast_environment->PostTask(
94 CastEnvironment::MAIN, 88 CastEnvironment::MAIN,
95 FROM_HERE, 89 FROM_HERE,
96 base::Bind(initialization_cb, cast_initialization_status_)); 90 base::Bind(initialization_cb, cast_initialization_status_));
97 } 91 }
98 92
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 DCHECK_GE(frames_in_encoder_, 0); 227 DCHECK_GE(frames_in_encoder_, 0);
234 228
235 duration_in_encoder_ = 229 duration_in_encoder_ =
236 last_enqueued_frame_reference_time_ - encoded_frame->reference_time; 230 last_enqueued_frame_reference_time_ - encoded_frame->reference_time;
237 231
238 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); 232 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass());
239 } 233 }
240 234
241 } // namespace cast 235 } // namespace cast
242 } // namespace media 236 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/sender/video_encoder_impl_unittest.cc ('k') | media/cast/sender/vp8_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698