| 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_receiver_impl.h" | 5 #include "media/cast/cast_receiver_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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 const AudioReceiverConfig& audio_config, | 85 const AudioReceiverConfig& audio_config, |
| 86 const VideoReceiverConfig& video_config, | 86 const VideoReceiverConfig& video_config, |
| 87 transport::PacketSender* const packet_sender) | 87 transport::PacketSender* const packet_sender) |
| 88 : pacer_(cast_environment->Clock(), | 88 : pacer_(cast_environment->Clock(), |
| 89 cast_environment->Logging(), | 89 cast_environment->Logging(), |
| 90 packet_sender, | 90 packet_sender, |
| 91 cast_environment->GetTaskRunner(CastEnvironment::MAIN)), | 91 cast_environment->GetTaskRunner(CastEnvironment::MAIN)), |
| 92 audio_receiver_(cast_environment, audio_config, &pacer_), | 92 audio_receiver_(cast_environment, audio_config, &pacer_), |
| 93 video_receiver_(cast_environment, | 93 video_receiver_(cast_environment, |
| 94 video_config, | 94 video_config, |
| 95 &pacer_, | 95 &pacer_), |
| 96 base::Bind(&CastReceiverImpl::UpdateTargetDelay, | |
| 97 base::Unretained(this))), | |
| 98 frame_receiver_(new LocalFrameReceiver(cast_environment, | 96 frame_receiver_(new LocalFrameReceiver(cast_environment, |
| 99 &audio_receiver_, | 97 &audio_receiver_, |
| 100 &video_receiver_)), | 98 &video_receiver_)), |
| 101 cast_environment_(cast_environment), | 99 cast_environment_(cast_environment), |
| 102 ssrc_of_audio_sender_(audio_config.incoming_ssrc), | 100 ssrc_of_audio_sender_(audio_config.incoming_ssrc), |
| 103 ssrc_of_video_sender_(video_config.incoming_ssrc) {} | 101 ssrc_of_video_sender_(video_config.incoming_ssrc) {} |
| 104 | 102 |
| 105 CastReceiverImpl::~CastReceiverImpl() {} | 103 CastReceiverImpl::~CastReceiverImpl() {} |
| 106 | 104 |
| 107 // The video and audio receivers should only be called from the main thread. | 105 // The video and audio receivers should only be called from the main thread. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 133 FROM_HERE, | 131 FROM_HERE, |
| 134 base::Bind(&VideoReceiver::IncomingPacket, | 132 base::Bind(&VideoReceiver::IncomingPacket, |
| 135 video_receiver_.AsWeakPtr(), | 133 video_receiver_.AsWeakPtr(), |
| 136 base::Passed(&packet))); | 134 base::Passed(&packet))); |
| 137 } else { | 135 } else { |
| 138 VLOG(1) << "Received a packet with a non matching sender SSRC " | 136 VLOG(1) << "Received a packet with a non matching sender SSRC " |
| 139 << ssrc_of_sender; | 137 << ssrc_of_sender; |
| 140 } | 138 } |
| 141 } | 139 } |
| 142 | 140 |
| 143 void CastReceiverImpl::UpdateTargetDelay(base::TimeDelta target_delay_ms) { | |
| 144 audio_receiver_.SetTargetDelay(target_delay_ms); | |
| 145 } | |
| 146 | |
| 147 transport::PacketReceiverCallback CastReceiverImpl::packet_receiver() { | 141 transport::PacketReceiverCallback CastReceiverImpl::packet_receiver() { |
| 148 return base::Bind(&CastReceiverImpl::ReceivedPacket, base::Unretained(this)); | 142 return base::Bind(&CastReceiverImpl::ReceivedPacket, base::Unretained(this)); |
| 149 } | 143 } |
| 150 | 144 |
| 151 scoped_refptr<FrameReceiver> CastReceiverImpl::frame_receiver() { | 145 scoped_refptr<FrameReceiver> CastReceiverImpl::frame_receiver() { |
| 152 return frame_receiver_; | 146 return frame_receiver_; |
| 153 } | 147 } |
| 154 | 148 |
| 155 } // namespace cast | 149 } // namespace cast |
| 156 } // namespace media | 150 } // namespace media |
| OLD | NEW |