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( | 103 video_encoder_.reset(new VideoEncoderImpl(cast_environment, video_config)); |
104 cast_environment, video_config, initialization_cb)); | |
105 cast_initialization_status_ = STATUS_VIDEO_INITIALIZED; | 104 cast_initialization_status_ = STATUS_VIDEO_INITIALIZED; |
106 } | 105 } |
107 #endif // !defined(OS_IOS) | 106 #endif // !defined(OS_IOS) |
108 | 107 |
| 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 |
109 media::cast::CastTransportRtpConfig transport_config; | 115 media::cast::CastTransportRtpConfig transport_config; |
110 transport_config.ssrc = video_config.ssrc; | 116 transport_config.ssrc = video_config.ssrc; |
111 transport_config.feedback_ssrc = video_config.receiver_ssrc; | 117 transport_config.feedback_ssrc = video_config.receiver_ssrc; |
112 transport_config.rtp_payload_type = video_config.rtp_payload_type; | 118 transport_config.rtp_payload_type = video_config.rtp_payload_type; |
113 transport_config.aes_key = video_config.aes_key; | 119 transport_config.aes_key = video_config.aes_key; |
114 transport_config.aes_iv_mask = video_config.aes_iv_mask; | 120 transport_config.aes_iv_mask = video_config.aes_iv_mask; |
115 | 121 |
116 transport_sender->InitializeVideo( | 122 transport_sender->InitializeVideo( |
117 transport_config, | 123 transport_config, |
118 base::Bind(&VideoSender::OnReceivedCastFeedback, | 124 base::Bind(&VideoSender::OnReceivedCastFeedback, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 DCHECK_GE(frames_in_encoder_, 0); | 263 DCHECK_GE(frames_in_encoder_, 0); |
258 | 264 |
259 duration_in_encoder_ = | 265 duration_in_encoder_ = |
260 last_enqueued_frame_reference_time_ - encoded_frame->reference_time; | 266 last_enqueued_frame_reference_time_ - encoded_frame->reference_time; |
261 | 267 |
262 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); | 268 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); |
263 } | 269 } |
264 | 270 |
265 } // namespace cast | 271 } // namespace cast |
266 } // namespace media | 272 } // namespace media |
OLD | NEW |