| 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 "chrome/renderer/media/cast_session_delegate.h" | 5 #include "chrome/renderer/media/cast_session_delegate.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "chrome/renderer/media/cast_threads.h" | 10 #include "chrome/renderer/media/cast_threads.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 const AudioFrameInputAvailableCallback& callback, | 43 const AudioFrameInputAvailableCallback& callback, |
| 44 const ErrorCallback& error_callback) { | 44 const ErrorCallback& error_callback) { |
| 45 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); | 45 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); |
| 46 | 46 |
| 47 if (!cast_transport_ || !cast_sender_) { | 47 if (!cast_transport_ || !cast_sender_) { |
| 48 error_callback.Run("Destination not set."); | 48 error_callback.Run("Destination not set."); |
| 49 return; | 49 return; |
| 50 } | 50 } |
| 51 | 51 |
| 52 audio_frame_input_available_callback_ = callback; | 52 audio_frame_input_available_callback_ = callback; |
| 53 media::cast::transport::CastTransportAudioConfig transport_config; | |
| 54 transport_config.base.ssrc = config.sender_ssrc; | |
| 55 transport_config.codec = config.codec; | |
| 56 transport_config.base.rtp_config = config.rtp_config; | |
| 57 transport_config.frequency = config.frequency; | |
| 58 transport_config.channels = config.channels; | |
| 59 cast_transport_->InitializeAudio(transport_config); | |
| 60 cast_sender_->InitializeAudio( | 53 cast_sender_->InitializeAudio( |
| 61 config, | 54 config, |
| 62 base::Bind(&CastSessionDelegate::InitializationResultCB, | 55 base::Bind(&CastSessionDelegate::InitializationResultCB, |
| 63 weak_factory_.GetWeakPtr())); | 56 weak_factory_.GetWeakPtr())); |
| 64 } | 57 } |
| 65 | 58 |
| 66 void CastSessionDelegate::StartVideo( | 59 void CastSessionDelegate::StartVideo( |
| 67 const VideoSenderConfig& config, | 60 const VideoSenderConfig& config, |
| 68 const VideoFrameInputAvailableCallback& callback, | 61 const VideoFrameInputAvailableCallback& callback, |
| 69 const ErrorCallback& error_callback, | 62 const ErrorCallback& error_callback, |
| 70 const media::cast::CreateVideoEncodeAcceleratorCallback& create_vea_cb, | 63 const media::cast::CreateVideoEncodeAcceleratorCallback& create_vea_cb, |
| 71 const media::cast::CreateVideoEncodeMemoryCallback& | 64 const media::cast::CreateVideoEncodeMemoryCallback& |
| 72 create_video_encode_mem_cb) { | 65 create_video_encode_mem_cb) { |
| 73 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); | 66 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); |
| 74 | 67 |
| 75 if (!cast_transport_ || !cast_sender_) { | 68 if (!cast_transport_ || !cast_sender_) { |
| 76 error_callback.Run("Destination not set."); | 69 error_callback.Run("Destination not set."); |
| 77 return; | 70 return; |
| 78 } | 71 } |
| 79 | 72 |
| 80 video_frame_input_available_callback_ = callback; | 73 video_frame_input_available_callback_ = callback; |
| 81 | 74 |
| 82 media::cast::transport::CastTransportVideoConfig transport_config; | |
| 83 transport_config.base.ssrc = config.sender_ssrc; | |
| 84 transport_config.codec = config.codec; | |
| 85 transport_config.base.rtp_config = config.rtp_config; | |
| 86 cast_transport_->InitializeVideo(transport_config); | |
| 87 cast_sender_->InitializeVideo( | 75 cast_sender_->InitializeVideo( |
| 88 config, | 76 config, |
| 89 base::Bind(&CastSessionDelegate::InitializationResultCB, | 77 base::Bind(&CastSessionDelegate::InitializationResultCB, |
| 90 weak_factory_.GetWeakPtr()), | 78 weak_factory_.GetWeakPtr()), |
| 91 create_vea_cb, | 79 create_vea_cb, |
| 92 create_video_encode_mem_cb); | 80 create_video_encode_mem_cb); |
| 93 } | 81 } |
| 94 | 82 |
| 95 void CastSessionDelegate::StartUDP(const net::IPEndPoint& remote_endpoint) { | 83 void CastSessionDelegate::StartUDP(const net::IPEndPoint& remote_endpoint) { |
| 96 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); | 84 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 ++it) { | 215 ++it) { |
| 228 cast_environment_->Logging()->InsertPacketEvent(it->timestamp, | 216 cast_environment_->Logging()->InsertPacketEvent(it->timestamp, |
| 229 it->type, | 217 it->type, |
| 230 it->rtp_timestamp, | 218 it->rtp_timestamp, |
| 231 it->frame_id, | 219 it->frame_id, |
| 232 it->packet_id, | 220 it->packet_id, |
| 233 it->max_packet_id, | 221 it->max_packet_id, |
| 234 it->size); | 222 it->size); |
| 235 } | 223 } |
| 236 } | 224 } |
| OLD | NEW |