| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/cast_sender_impl.h" | 5 #include "media/cast/cast_sender_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 CastSenderImpl::CastSenderImpl(scoped_refptr<CastEnvironment> cast_environment, | 102 CastSenderImpl::CastSenderImpl(scoped_refptr<CastEnvironment> cast_environment, |
| 103 CastTransport* const transport_sender) | 103 CastTransport* const transport_sender) |
| 104 : cast_environment_(cast_environment), | 104 : cast_environment_(cast_environment), |
| 105 transport_sender_(transport_sender), | 105 transport_sender_(transport_sender), |
| 106 weak_factory_(this) { | 106 weak_factory_(this) { |
| 107 CHECK(cast_environment.get()); | 107 CHECK(cast_environment.get()); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void CastSenderImpl::InitializeAudio( | 110 void CastSenderImpl::InitializeAudio( |
| 111 const AudioSenderConfig& audio_config, | 111 const FrameSenderConfig& audio_config, |
| 112 const StatusChangeCallback& status_change_cb) { | 112 const StatusChangeCallback& status_change_cb) { |
| 113 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 113 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 114 CHECK(audio_config.use_external_encoder || | 114 CHECK(audio_config.use_external_encoder || |
| 115 cast_environment_->HasAudioThread()); | 115 cast_environment_->HasAudioThread()); |
| 116 | 116 |
| 117 VLOG(1) << "CastSenderImpl@" << this << "::InitializeAudio()"; | 117 VLOG(1) << "CastSenderImpl@" << this << "::InitializeAudio()"; |
| 118 | 118 |
| 119 audio_sender_.reset( | 119 audio_sender_.reset( |
| 120 new AudioSender(cast_environment_, | 120 new AudioSender(cast_environment_, |
| 121 audio_config, | 121 audio_config, |
| 122 base::Bind(&CastSenderImpl::OnAudioStatusChange, | 122 base::Bind(&CastSenderImpl::OnAudioStatusChange, |
| 123 weak_factory_.GetWeakPtr(), | 123 weak_factory_.GetWeakPtr(), |
| 124 status_change_cb), | 124 status_change_cb), |
| 125 transport_sender_)); | 125 transport_sender_)); |
| 126 if (video_sender_) { | 126 if (video_sender_) { |
| 127 DCHECK(audio_sender_->GetTargetPlayoutDelay() == | 127 DCHECK(audio_sender_->GetTargetPlayoutDelay() == |
| 128 video_sender_->GetTargetPlayoutDelay()); | 128 video_sender_->GetTargetPlayoutDelay()); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 void CastSenderImpl::InitializeVideo( | 132 void CastSenderImpl::InitializeVideo( |
| 133 const VideoSenderConfig& video_config, | 133 const FrameSenderConfig& video_config, |
| 134 const StatusChangeCallback& status_change_cb, | 134 const StatusChangeCallback& status_change_cb, |
| 135 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, | 135 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, |
| 136 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) { | 136 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) { |
| 137 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 137 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 138 | 138 |
| 139 VLOG(1) << "CastSenderImpl@" << this << "::InitializeVideo()"; | 139 VLOG(1) << "CastSenderImpl@" << this << "::InitializeVideo()"; |
| 140 | 140 |
| 141 video_sender_.reset(new VideoSender( | 141 video_sender_.reset(new VideoSender( |
| 142 cast_environment_, | 142 cast_environment_, |
| 143 video_config, | 143 video_config, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 196 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 197 if (status == STATUS_INITIALIZED && !video_frame_input_) { | 197 if (status == STATUS_INITIALIZED && !video_frame_input_) { |
| 198 video_frame_input_ = | 198 video_frame_input_ = |
| 199 new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr()); | 199 new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr()); |
| 200 } | 200 } |
| 201 status_change_cb.Run(status); | 201 status_change_cb.Run(status); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace cast | 204 } // namespace cast |
| 205 } // namespace media | 205 } // namespace media |
| OLD | NEW |