| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <cstring> | 10 #include <cstring> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/ptr_util.h" |
| 15 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 16 #include "media/cast/net/cast_transport_config.h" | 17 #include "media/cast/net/cast_transport_config.h" |
| 17 #include "media/cast/sender/performance_metrics_overlay.h" | 18 #include "media/cast/sender/performance_metrics_overlay.h" |
| 18 #include "media/cast/sender/video_encoder.h" | 19 #include "media/cast/sender/video_encoder.h" |
| 19 | 20 |
| 20 namespace media { | 21 namespace media { |
| 21 namespace cast { | 22 namespace cast { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 133 } |
| 133 | 134 |
| 134 media::cast::CastTransportRtpConfig transport_config; | 135 media::cast::CastTransportRtpConfig transport_config; |
| 135 transport_config.ssrc = video_config.ssrc; | 136 transport_config.ssrc = video_config.ssrc; |
| 136 transport_config.feedback_ssrc = video_config.receiver_ssrc; | 137 transport_config.feedback_ssrc = video_config.receiver_ssrc; |
| 137 transport_config.rtp_payload_type = video_config.rtp_payload_type; | 138 transport_config.rtp_payload_type = video_config.rtp_payload_type; |
| 138 transport_config.aes_key = video_config.aes_key; | 139 transport_config.aes_key = video_config.aes_key; |
| 139 transport_config.aes_iv_mask = video_config.aes_iv_mask; | 140 transport_config.aes_iv_mask = video_config.aes_iv_mask; |
| 140 | 141 |
| 141 transport_sender->InitializeVideo( | 142 transport_sender->InitializeVideo( |
| 142 transport_config, base::Bind(&VideoSender::OnReceivedCastFeedback, | 143 transport_config, base::WrapUnique(new FrameSender::RtcpClient( |
| 143 weak_factory_.GetWeakPtr()), | 144 weak_factory_.GetWeakPtr()))); |
| 144 base::Bind(&VideoSender::OnMeasuredRoundTripTime, | |
| 145 weak_factory_.GetWeakPtr()), | |
| 146 base::Bind(&VideoSender::OnReceivedPli, weak_factory_.GetWeakPtr())); | |
| 147 } | 145 } |
| 148 | 146 |
| 149 VideoSender::~VideoSender() { | 147 VideoSender::~VideoSender() { |
| 150 } | 148 } |
| 151 | 149 |
| 152 void VideoSender::InsertRawVideoFrame( | 150 void VideoSender::InsertRawVideoFrame( |
| 153 const scoped_refptr<media::VideoFrame>& video_frame, | 151 const scoped_refptr<media::VideoFrame>& video_frame, |
| 154 const base::TimeTicks& reference_time) { | 152 const base::TimeTicks& reference_time) { |
| 155 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 153 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 156 | 154 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 media::VideoFrameMetadata::RESOURCE_UTILIZATION, | 349 media::VideoFrameMetadata::RESOURCE_UTILIZATION, |
| 352 encoded_frame->dependency == EncodedFrame::KEY ? | 350 encoded_frame->dependency == EncodedFrame::KEY ? |
| 353 std::min(1.0, attenuated_utilization) : attenuated_utilization); | 351 std::min(1.0, attenuated_utilization) : attenuated_utilization); |
| 354 } | 352 } |
| 355 | 353 |
| 356 SendEncodedFrame(encoder_bitrate, std::move(encoded_frame)); | 354 SendEncodedFrame(encoder_bitrate, std::move(encoded_frame)); |
| 357 } | 355 } |
| 358 | 356 |
| 359 } // namespace cast | 357 } // namespace cast |
| 360 } // namespace media | 358 } // namespace media |
| OLD | NEW |