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); |
53 cast_sender_->InitializeAudio( | 60 cast_sender_->InitializeAudio( |
54 config, | 61 config, |
55 base::Bind(&CastSessionDelegate::InitializationResultCB, | 62 base::Bind(&CastSessionDelegate::InitializationResultCB, |
56 weak_factory_.GetWeakPtr())); | 63 weak_factory_.GetWeakPtr())); |
57 } | 64 } |
58 | 65 |
59 void CastSessionDelegate::StartVideo( | 66 void CastSessionDelegate::StartVideo( |
60 const VideoSenderConfig& config, | 67 const VideoSenderConfig& config, |
61 const VideoFrameInputAvailableCallback& callback, | 68 const VideoFrameInputAvailableCallback& callback, |
62 const ErrorCallback& error_callback, | 69 const ErrorCallback& error_callback, |
63 const media::cast::CreateVideoEncodeAcceleratorCallback& create_vea_cb, | 70 const media::cast::CreateVideoEncodeAcceleratorCallback& create_vea_cb, |
64 const media::cast::CreateVideoEncodeMemoryCallback& | 71 const media::cast::CreateVideoEncodeMemoryCallback& |
65 create_video_encode_mem_cb) { | 72 create_video_encode_mem_cb) { |
66 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); | 73 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); |
67 | 74 |
68 if (!cast_transport_ || !cast_sender_) { | 75 if (!cast_transport_ || !cast_sender_) { |
69 error_callback.Run("Destination not set."); | 76 error_callback.Run("Destination not set."); |
70 return; | 77 return; |
71 } | 78 } |
72 | 79 |
73 video_frame_input_available_callback_ = callback; | 80 video_frame_input_available_callback_ = callback; |
74 | 81 |
| 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); |
75 cast_sender_->InitializeVideo( | 87 cast_sender_->InitializeVideo( |
76 config, | 88 config, |
77 base::Bind(&CastSessionDelegate::InitializationResultCB, | 89 base::Bind(&CastSessionDelegate::InitializationResultCB, |
78 weak_factory_.GetWeakPtr()), | 90 weak_factory_.GetWeakPtr()), |
79 create_vea_cb, | 91 create_vea_cb, |
80 create_video_encode_mem_cb); | 92 create_video_encode_mem_cb); |
81 } | 93 } |
82 | 94 |
83 void CastSessionDelegate::StartUDP(const net::IPEndPoint& remote_endpoint) { | 95 void CastSessionDelegate::StartUDP(const net::IPEndPoint& remote_endpoint) { |
84 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); | 96 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 ++it) { | 227 ++it) { |
216 cast_environment_->Logging()->InsertPacketEvent(it->timestamp, | 228 cast_environment_->Logging()->InsertPacketEvent(it->timestamp, |
217 it->type, | 229 it->type, |
218 it->rtp_timestamp, | 230 it->rtp_timestamp, |
219 it->frame_id, | 231 it->frame_id, |
220 it->packet_id, | 232 it->packet_id, |
221 it->max_packet_id, | 233 it->max_packet_id, |
222 it->size); | 234 it->size); |
223 } | 235 } |
224 } | 236 } |
OLD | NEW |