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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 video_encoder_.reset(new ExternalVideoEncoder( | 93 video_encoder_.reset(new ExternalVideoEncoder( |
94 cast_environment, | 94 cast_environment, |
95 video_config, | 95 video_config, |
96 gfx::Size(video_config.width, video_config.height), | 96 gfx::Size(video_config.width, video_config.height), |
97 base::Bind(&VideoSender::OnEncoderInitialized, | 97 base::Bind(&VideoSender::OnEncoderInitialized, |
98 weak_factory_.GetWeakPtr(), initialization_cb), | 98 weak_factory_.GetWeakPtr(), initialization_cb), |
99 create_vea_cb, | 99 create_vea_cb, |
100 create_video_encode_mem_cb)); | 100 create_video_encode_mem_cb)); |
101 } else if (!video_encoder_) { | 101 } else if (!video_encoder_) { |
102 // Software encoder is initialized immediately. | 102 // Software encoder is initialized immediately. |
103 video_encoder_.reset(new VideoEncoderImpl(cast_environment, video_config)); | 103 video_encoder_.reset(new VideoEncoderImpl( |
| 104 cast_environment, video_config, initialization_cb)); |
104 cast_initialization_status_ = STATUS_VIDEO_INITIALIZED; | 105 cast_initialization_status_ = STATUS_VIDEO_INITIALIZED; |
105 } | 106 } |
106 #endif // !defined(OS_IOS) | 107 #endif // !defined(OS_IOS) |
107 | 108 |
108 if (cast_initialization_status_ == STATUS_VIDEO_INITIALIZED) { | |
109 cast_environment->PostTask( | |
110 CastEnvironment::MAIN, | |
111 FROM_HERE, | |
112 base::Bind(initialization_cb, cast_initialization_status_)); | |
113 } | |
114 | |
115 media::cast::CastTransportRtpConfig transport_config; | 109 media::cast::CastTransportRtpConfig transport_config; |
116 transport_config.ssrc = video_config.ssrc; | 110 transport_config.ssrc = video_config.ssrc; |
117 transport_config.feedback_ssrc = video_config.receiver_ssrc; | 111 transport_config.feedback_ssrc = video_config.receiver_ssrc; |
118 transport_config.rtp_payload_type = video_config.rtp_payload_type; | 112 transport_config.rtp_payload_type = video_config.rtp_payload_type; |
119 transport_config.aes_key = video_config.aes_key; | 113 transport_config.aes_key = video_config.aes_key; |
120 transport_config.aes_iv_mask = video_config.aes_iv_mask; | 114 transport_config.aes_iv_mask = video_config.aes_iv_mask; |
121 | 115 |
122 transport_sender->InitializeVideo( | 116 transport_sender->InitializeVideo( |
123 transport_config, | 117 transport_config, |
124 base::Bind(&VideoSender::OnReceivedCastFeedback, | 118 base::Bind(&VideoSender::OnReceivedCastFeedback, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 DCHECK_GE(frames_in_encoder_, 0); | 257 DCHECK_GE(frames_in_encoder_, 0); |
264 | 258 |
265 duration_in_encoder_ = | 259 duration_in_encoder_ = |
266 last_enqueued_frame_reference_time_ - encoded_frame->reference_time; | 260 last_enqueued_frame_reference_time_ - encoded_frame->reference_time; |
267 | 261 |
268 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); | 262 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); |
269 } | 263 } |
270 | 264 |
271 } // namespace cast | 265 } // namespace cast |
272 } // namespace media | 266 } // namespace media |
OLD | NEW |