| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 if (video_config.use_external_encoder) { | 89 if (video_config.use_external_encoder) { |
| 90 video_encoder_.reset(new ExternalVideoEncoder( | 90 video_encoder_.reset(new ExternalVideoEncoder( |
| 91 cast_environment, | 91 cast_environment, |
| 92 video_config, | 92 video_config, |
| 93 base::Bind(&VideoSender::OnEncoderInitialized, | 93 base::Bind(&VideoSender::OnEncoderInitialized, |
| 94 weak_factory_.GetWeakPtr(), initialization_cb), | 94 weak_factory_.GetWeakPtr(), initialization_cb), |
| 95 create_vea_cb, | 95 create_vea_cb, |
| 96 create_video_encode_mem_cb)); | 96 create_video_encode_mem_cb)); |
| 97 } else if (!video_encoder_) { | 97 } else if (!video_encoder_) { |
| 98 // Software encoder is initialized immediately. | 98 // Software encoder is initialized immediately. |
| 99 video_encoder_.reset(new VideoEncoderImpl(cast_environment, video_config)); | 99 video_encoder_.reset(new VideoEncoderImpl( |
| 100 cast_environment, video_config, initialization_cb)); |
| 100 cast_initialization_status_ = STATUS_VIDEO_INITIALIZED; | 101 cast_initialization_status_ = STATUS_VIDEO_INITIALIZED; |
| 101 } | 102 } |
| 102 #endif // !defined(OS_IOS) | 103 #endif // !defined(OS_IOS) |
| 103 | 104 |
| 104 if (cast_initialization_status_ == STATUS_VIDEO_INITIALIZED) { | |
| 105 cast_environment->PostTask( | |
| 106 CastEnvironment::MAIN, | |
| 107 FROM_HERE, | |
| 108 base::Bind(initialization_cb, cast_initialization_status_)); | |
| 109 } | |
| 110 | |
| 111 media::cast::CastTransportRtpConfig transport_config; | 105 media::cast::CastTransportRtpConfig transport_config; |
| 112 transport_config.ssrc = video_config.ssrc; | 106 transport_config.ssrc = video_config.ssrc; |
| 113 transport_config.feedback_ssrc = video_config.receiver_ssrc; | 107 transport_config.feedback_ssrc = video_config.receiver_ssrc; |
| 114 transport_config.rtp_payload_type = video_config.rtp_payload_type; | 108 transport_config.rtp_payload_type = video_config.rtp_payload_type; |
| 115 transport_config.aes_key = video_config.aes_key; | 109 transport_config.aes_key = video_config.aes_key; |
| 116 transport_config.aes_iv_mask = video_config.aes_iv_mask; | 110 transport_config.aes_iv_mask = video_config.aes_iv_mask; |
| 117 | 111 |
| 118 transport_sender->InitializeVideo( | 112 transport_sender->InitializeVideo( |
| 119 transport_config, | 113 transport_config, |
| 120 base::Bind(&VideoSender::OnReceivedCastFeedback, | 114 base::Bind(&VideoSender::OnReceivedCastFeedback, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 DCHECK_GE(frames_in_encoder_, 0); | 245 DCHECK_GE(frames_in_encoder_, 0); |
| 252 | 246 |
| 253 duration_in_encoder_ = | 247 duration_in_encoder_ = |
| 254 last_enqueued_frame_reference_time_ - encoded_frame->reference_time; | 248 last_enqueued_frame_reference_time_ - encoded_frame->reference_time; |
| 255 | 249 |
| 256 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); | 250 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); |
| 257 } | 251 } |
| 258 | 252 |
| 259 } // namespace cast | 253 } // namespace cast |
| 260 } // namespace media | 254 } // namespace media |
| OLD | NEW |