| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 playout_delay_change_cb_(playout_delay_change_cb), | 73 playout_delay_change_cb_(playout_delay_change_cb), |
| 74 weak_factory_(this) { | 74 weak_factory_(this) { |
| 75 cast_initialization_status_ = STATUS_VIDEO_UNINITIALIZED; | 75 cast_initialization_status_ = STATUS_VIDEO_UNINITIALIZED; |
| 76 | 76 |
| 77 #if defined(OS_MACOSX) | 77 #if defined(OS_MACOSX) |
| 78 // On Apple platforms, use the hardware H.264 encoder if possible. It is the | 78 // On Apple platforms, use the hardware H.264 encoder if possible. It is the |
| 79 // only reasonable option for iOS. | 79 // only reasonable option for iOS. |
| 80 if (!video_config.use_external_encoder && | 80 if (!video_config.use_external_encoder && |
| 81 video_config.codec == CODEC_VIDEO_H264) { | 81 video_config.codec == CODEC_VIDEO_H264) { |
| 82 video_encoder_.reset(new H264VideoToolboxEncoder( | 82 video_encoder_.reset(new H264VideoToolboxEncoder( |
| 83 cast_environment, video_config, | 83 cast_environment, |
| 84 video_config, |
| 85 gfx::Size(video_config.width, video_config.height), |
| 84 base::Bind(&VideoSender::OnEncoderInitialized, | 86 base::Bind(&VideoSender::OnEncoderInitialized, |
| 85 weak_factory_.GetWeakPtr(), initialization_cb))); | 87 weak_factory_.GetWeakPtr(), |
| 88 initialization_cb))); |
| 86 } | 89 } |
| 87 #endif // defined(OS_MACOSX) | 90 #endif // defined(OS_MACOSX) |
| 88 #if !defined(OS_IOS) | 91 #if !defined(OS_IOS) |
| 89 if (video_config.use_external_encoder) { | 92 if (video_config.use_external_encoder) { |
| 90 video_encoder_.reset(new ExternalVideoEncoder( | 93 video_encoder_.reset(new ExternalVideoEncoder( |
| 91 cast_environment, | 94 cast_environment, |
| 92 video_config, | 95 video_config, |
| 93 base::Bind(&VideoSender::OnEncoderInitialized, | 96 base::Bind(&VideoSender::OnEncoderInitialized, |
| 94 weak_factory_.GetWeakPtr(), initialization_cb), | 97 weak_factory_.GetWeakPtr(), initialization_cb), |
| 95 create_vea_cb, | 98 create_vea_cb, |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 DCHECK_GE(frames_in_encoder_, 0); | 254 DCHECK_GE(frames_in_encoder_, 0); |
| 252 | 255 |
| 253 duration_in_encoder_ = | 256 duration_in_encoder_ = |
| 254 last_enqueued_frame_reference_time_ - encoded_frame->reference_time; | 257 last_enqueued_frame_reference_time_ - encoded_frame->reference_time; |
| 255 | 258 |
| 256 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); | 259 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); |
| 257 } | 260 } |
| 258 | 261 |
| 259 } // namespace cast | 262 } // namespace cast |
| 260 } // namespace media | 263 } // namespace media |
| OLD | NEW |