| 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/net/cast_transport_sender_impl.h" | 5 #include "media/cast/net/cast_transport_sender_impl.h" |
| 6 | 6 |
| 7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
| 8 #include "media/cast/net/cast_transport_config.h" | 8 #include "media/cast/net/cast_transport_config.h" |
| 9 #include "media/cast/net/cast_transport_defines.h" | 9 #include "media/cast/net/cast_transport_defines.h" |
| 10 #include "media/cast/net/udp_transport.h" | 10 #include "media/cast/net/udp_transport.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 void CastTransportSenderImpl::InitializeAudio( | 82 void CastTransportSenderImpl::InitializeAudio( |
| 83 const CastTransportRtpConfig& config) { | 83 const CastTransportRtpConfig& config) { |
| 84 LOG_IF(WARNING, config.aes_key.empty() || config.aes_iv_mask.empty()) | 84 LOG_IF(WARNING, config.aes_key.empty() || config.aes_iv_mask.empty()) |
| 85 << "Unsafe to send audio with encryption DISABLED."; | 85 << "Unsafe to send audio with encryption DISABLED."; |
| 86 if (!audio_encryptor_.Initialize(config.aes_key, config.aes_iv_mask)) { | 86 if (!audio_encryptor_.Initialize(config.aes_key, config.aes_iv_mask)) { |
| 87 status_callback_.Run(TRANSPORT_AUDIO_UNINITIALIZED); | 87 status_callback_.Run(TRANSPORT_AUDIO_UNINITIALIZED); |
| 88 return; | 88 return; |
| 89 } | 89 } |
| 90 audio_sender_.reset(new RtpSender(clock_, transport_task_runner_, &pacer_)); | 90 audio_sender_.reset(new RtpSender(clock_, transport_task_runner_, &pacer_)); |
| 91 if (audio_sender_->Initialize(config)) { | 91 if (audio_sender_->Initialize(config)) { |
| 92 // Audio packets have a higher priority. |
| 92 pacer_.RegisterAudioSsrc(config.ssrc); | 93 pacer_.RegisterAudioSsrc(config.ssrc); |
| 94 pacer_.RegisterPrioritySsrc(config.ssrc); |
| 93 status_callback_.Run(TRANSPORT_AUDIO_INITIALIZED); | 95 status_callback_.Run(TRANSPORT_AUDIO_INITIALIZED); |
| 94 } else { | 96 } else { |
| 95 audio_sender_.reset(); | 97 audio_sender_.reset(); |
| 96 status_callback_.Run(TRANSPORT_AUDIO_UNINITIALIZED); | 98 status_callback_.Run(TRANSPORT_AUDIO_UNINITIALIZED); |
| 97 } | 99 } |
| 98 } | 100 } |
| 99 | 101 |
| 100 void CastTransportSenderImpl::InitializeVideo( | 102 void CastTransportSenderImpl::InitializeVideo( |
| 101 const CastTransportRtpConfig& config) { | 103 const CastTransportRtpConfig& config) { |
| 102 LOG_IF(WARNING, config.aes_key.empty() || config.aes_iv_mask.empty()) | 104 LOG_IF(WARNING, config.aes_key.empty() || config.aes_iv_mask.empty()) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 void CastTransportSenderImpl::SendRawEvents() { | 200 void CastTransportSenderImpl::SendRawEvents() { |
| 199 DCHECK(event_subscriber_.get()); | 201 DCHECK(event_subscriber_.get()); |
| 200 DCHECK(!raw_events_callback_.is_null()); | 202 DCHECK(!raw_events_callback_.is_null()); |
| 201 std::vector<PacketEvent> packet_events; | 203 std::vector<PacketEvent> packet_events; |
| 202 event_subscriber_->GetPacketEventsAndReset(&packet_events); | 204 event_subscriber_->GetPacketEventsAndReset(&packet_events); |
| 203 raw_events_callback_.Run(packet_events); | 205 raw_events_callback_.Run(packet_events); |
| 204 } | 206 } |
| 205 | 207 |
| 206 } // namespace cast | 208 } // namespace cast |
| 207 } // namespace media | 209 } // namespace media |
| OLD | NEW |