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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 CastReceiverImpl::CastReceiverImpl( | 94 CastReceiverImpl::CastReceiverImpl( |
95 scoped_refptr<CastEnvironment> cast_environment, | 95 scoped_refptr<CastEnvironment> cast_environment, |
96 const AudioReceiverConfig& audio_config, | 96 const AudioReceiverConfig& audio_config, |
97 const VideoReceiverConfig& video_config, | 97 const VideoReceiverConfig& video_config, |
98 transport::PacketSender* const packet_sender) | 98 transport::PacketSender* const packet_sender) |
99 : pacer_(cast_environment->Clock(), | 99 : pacer_(cast_environment->Clock(), |
100 packet_sender, | 100 packet_sender, |
101 cast_environment->GetTaskRunner(CastEnvironment::TRANSPORT)), | 101 cast_environment->GetTaskRunner(CastEnvironment::TRANSPORT)), |
102 audio_receiver_(cast_environment, audio_config, &pacer_), | 102 audio_receiver_(cast_environment, audio_config, &pacer_), |
103 video_receiver_(cast_environment, video_config, &pacer_), | 103 video_receiver_(cast_environment, |
| 104 video_config, |
| 105 &pacer_, |
| 106 base::Bind(&CastReceiverImpl::UpdateTargetDelay, |
| 107 base::Unretained(this))), |
104 frame_receiver_(new LocalFrameReceiver(cast_environment, | 108 frame_receiver_(new LocalFrameReceiver(cast_environment, |
105 &audio_receiver_, | 109 &audio_receiver_, |
106 &video_receiver_)), | 110 &video_receiver_)), |
107 cast_environment_(cast_environment), | 111 cast_environment_(cast_environment), |
108 ssrc_of_audio_sender_(audio_config.incoming_ssrc), | 112 ssrc_of_audio_sender_(audio_config.incoming_ssrc), |
109 ssrc_of_video_sender_(video_config.incoming_ssrc) {} | 113 ssrc_of_video_sender_(video_config.incoming_ssrc) {} |
110 | 114 |
111 CastReceiverImpl::~CastReceiverImpl() {} | 115 CastReceiverImpl::~CastReceiverImpl() {} |
112 | 116 |
113 // The video and audio receivers should only be called from the main thread. | 117 // The video and audio receivers should only be called from the main thread. |
(...skipping 25 matching lines...) Expand all Loading... |
139 FROM_HERE, | 143 FROM_HERE, |
140 base::Bind(&VideoReceiver::IncomingPacket, | 144 base::Bind(&VideoReceiver::IncomingPacket, |
141 video_receiver_.AsWeakPtr(), | 145 video_receiver_.AsWeakPtr(), |
142 base::Passed(&packet))); | 146 base::Passed(&packet))); |
143 } else { | 147 } else { |
144 VLOG(1) << "Received a packet with a non matching sender SSRC " | 148 VLOG(1) << "Received a packet with a non matching sender SSRC " |
145 << ssrc_of_sender; | 149 << ssrc_of_sender; |
146 } | 150 } |
147 } | 151 } |
148 | 152 |
| 153 void CastReceiverImpl::UpdateTargetDelay(base::TimeDelta target_delay_ms) { |
| 154 audio_receiver_.SetTargetDelay(target_delay_ms); |
| 155 } |
| 156 |
149 transport::PacketReceiverCallback CastReceiverImpl::packet_receiver() { | 157 transport::PacketReceiverCallback CastReceiverImpl::packet_receiver() { |
150 return base::Bind(&CastReceiverImpl::ReceivedPacket, base::Unretained(this)); | 158 return base::Bind(&CastReceiverImpl::ReceivedPacket, base::Unretained(this)); |
151 } | 159 } |
152 | 160 |
153 scoped_refptr<FrameReceiver> CastReceiverImpl::frame_receiver() { | 161 scoped_refptr<FrameReceiver> CastReceiverImpl::frame_receiver() { |
154 return frame_receiver_; | 162 return frame_receiver_; |
155 } | 163 } |
156 | 164 |
157 } // namespace cast | 165 } // namespace cast |
158 } // namespace media | 166 } // namespace media |
OLD | NEW |