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 #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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // See details: crbug.com/392086. | 62 // See details: crbug.com/392086. |
63 VideoSender::VideoSender( | 63 VideoSender::VideoSender( |
64 scoped_refptr<CastEnvironment> cast_environment, | 64 scoped_refptr<CastEnvironment> cast_environment, |
65 const VideoSenderConfig& video_config, | 65 const VideoSenderConfig& video_config, |
66 const StatusChangeCallback& status_change_cb, | 66 const StatusChangeCallback& status_change_cb, |
67 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, | 67 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, |
68 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb, | 68 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb, |
69 CastTransportSender* const transport_sender, | 69 CastTransportSender* const transport_sender, |
70 const PlayoutDelayChangeCB& playout_delay_change_cb) | 70 const PlayoutDelayChangeCB& playout_delay_change_cb) |
71 : FrameSender( | 71 : FrameSender( |
72 cast_environment, | 72 cast_environment, |
73 false, | 73 false, |
74 transport_sender, | 74 transport_sender, |
75 base::TimeDelta::FromMilliseconds(video_config.rtcp_interval), | 75 kVideoFrequency, |
76 kVideoFrequency, | 76 video_config.ssrc, |
77 video_config.ssrc, | 77 video_config.max_frame_rate, |
78 video_config.max_frame_rate, | 78 video_config.min_playout_delay, |
79 video_config.min_playout_delay, | 79 video_config.max_playout_delay, |
80 video_config.max_playout_delay, | 80 video_config.use_external_encoder |
81 video_config.use_external_encoder ? | 81 ? NewFixedCongestionControl( |
82 NewFixedCongestionControl( | 82 (video_config.min_bitrate + video_config.max_bitrate) / 2) |
83 (video_config.min_bitrate + video_config.max_bitrate) / 2) : | 83 : NewAdaptiveCongestionControl(cast_environment->Clock(), |
84 NewAdaptiveCongestionControl(cast_environment->Clock(), | 84 video_config.max_bitrate, |
85 video_config.max_bitrate, | 85 video_config.min_bitrate, |
86 video_config.min_bitrate, | 86 video_config.max_frame_rate)), |
87 video_config.max_frame_rate)), | |
88 frames_in_encoder_(0), | 87 frames_in_encoder_(0), |
89 last_bitrate_(0), | 88 last_bitrate_(0), |
90 playout_delay_change_cb_(playout_delay_change_cb), | 89 playout_delay_change_cb_(playout_delay_change_cb), |
91 weak_factory_(this) { | 90 weak_factory_(this) { |
92 video_encoder_ = VideoEncoder::Create( | 91 video_encoder_ = VideoEncoder::Create( |
93 cast_environment_, | 92 cast_environment_, |
94 video_config, | 93 video_config, |
95 status_change_cb, | 94 status_change_cb, |
96 create_vea_cb, | 95 create_vea_cb, |
97 create_video_encode_mem_cb); | 96 create_video_encode_mem_cb); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 DCHECK_GE(frames_in_encoder_, 0); | 240 DCHECK_GE(frames_in_encoder_, 0); |
242 | 241 |
243 duration_in_encoder_ = | 242 duration_in_encoder_ = |
244 last_enqueued_frame_reference_time_ - encoded_frame->reference_time; | 243 last_enqueued_frame_reference_time_ - encoded_frame->reference_time; |
245 | 244 |
246 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); | 245 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); |
247 } | 246 } |
248 | 247 |
249 } // namespace cast | 248 } // namespace cast |
250 } // namespace media | 249 } // namespace media |
OLD | NEW |