Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: media/cast/test/receiver.cc

Issue 136903003: cast: Wire upp logging to be sent over RTCP between receiver and sender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge TOT Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/cast/test/end2end_unittest.cc ('k') | media/cast/test/sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <climits> 6 #include <climits>
7 #include <cstdarg> 7 #include <cstdarg>
8 #include <cstdio> 8 #include <cstdio>
9 #include <string> 9 #include <string>
10 10
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 private: 160 private:
161 friend class base::RefCountedThreadSafe<ReceiveProcess>; 161 friend class base::RefCountedThreadSafe<ReceiveProcess>;
162 162
163 void DisplayFrame(const scoped_refptr<media::VideoFrame>& video_frame, 163 void DisplayFrame(const scoped_refptr<media::VideoFrame>& video_frame,
164 const base::TimeTicks& render_time) { 164 const base::TimeTicks& render_time) {
165 #ifdef OS_LINUX 165 #ifdef OS_LINUX
166 render_.RenderFrame(video_frame); 166 render_.RenderFrame(video_frame);
167 #endif // OS_LINUX 167 #endif // OS_LINUX
168 // Print out the delta between frames. 168 // Print out the delta between frames.
169 if (!last_render_time_.is_null()){ 169 if (!last_render_time_.is_null()) {
170 base::TimeDelta time_diff = render_time - last_render_time_; 170 base::TimeDelta time_diff = render_time - last_render_time_;
171 VLOG(0) << " RenderDelay[mS] = " << time_diff.InMilliseconds(); 171 VLOG(0) << " RenderDelay[mS] = " << time_diff.InMilliseconds();
172 } 172 }
173 last_render_time_ = render_time; 173 last_render_time_ = render_time;
174 GetVideoFrame(); 174 GetVideoFrame();
175 } 175 }
176 176
177 void ReceiveAudioFrame(scoped_ptr<PcmAudioFrame> audio_frame, 177 void ReceiveAudioFrame(scoped_ptr<PcmAudioFrame> audio_frame,
178 const base::TimeTicks& playout_time) { 178 const base::TimeTicks& playout_time) {
179 // For audio just print the playout delta between audio frames. 179 // For audio just print the playout delta between audio frames.
180 // Default diff time is kFrameTimerMs. 180 // Default diff time is kFrameTimerMs.
181 base::TimeDelta time_diff = 181 base::TimeDelta time_diff =
182 base::TimeDelta::FromMilliseconds(kFrameTimerMs); 182 base::TimeDelta::FromMilliseconds(kFrameTimerMs);
183 if (!last_playout_time_.is_null()){ 183 if (!last_playout_time_.is_null()) {
184 time_diff = playout_time - last_playout_time_; 184 time_diff = playout_time - last_playout_time_;
185 VLOG(0) << " ***PlayoutDelay[mS] = " << time_diff.InMilliseconds(); 185 VLOG(0) << " ***PlayoutDelay[mS] = " << time_diff.InMilliseconds();
186 } 186 }
187 last_playout_time_ = playout_time; 187 last_playout_time_ = playout_time;
188 GetAudioFrame(time_diff); 188 GetAudioFrame(time_diff);
189 } 189 }
190 190
191 void GetAudioFrame(base::TimeDelta playout_diff) { 191 void GetAudioFrame(base::TimeDelta playout_diff) {
192 int num_10ms_blocks = playout_diff.InMilliseconds() / 10; 192 int num_10ms_blocks = playout_diff.InMilliseconds() / 10;
193 frame_receiver_->GetRawAudioFrame(num_10ms_blocks, kAudioSamplingFrequency, 193 frame_receiver_->GetRawAudioFrame(num_10ms_blocks, kAudioSamplingFrequency,
(...skipping 24 matching lines...) Expand all
218 218
219 VLOG(1) << "Cast Receiver"; 219 VLOG(1) << "Cast Receiver";
220 base::Thread audio_thread("Cast audio decoder thread"); 220 base::Thread audio_thread("Cast audio decoder thread");
221 base::Thread video_thread("Cast video decoder thread"); 221 base::Thread video_thread("Cast video decoder thread");
222 audio_thread.Start(); 222 audio_thread.Start();
223 video_thread.Start(); 223 video_thread.Start();
224 224
225 base::DefaultTickClock clock; 225 base::DefaultTickClock clock;
226 // Enable receiver side threads, and disable logging. 226 // Enable receiver side threads, and disable logging.
227 scoped_refptr<media::cast::CastEnvironment> cast_environment(new 227 scoped_refptr<media::cast::CastEnvironment> cast_environment(new
228 media::cast::CastEnvironment(&clock, 228 media::cast::CastEnvironment(
229 main_message_loop.message_loop_proxy(), 229 &clock,
230 NULL, 230 main_message_loop.message_loop_proxy(),
231 audio_thread.message_loop_proxy(), 231 NULL,
232 NULL, 232 audio_thread.message_loop_proxy(),
233 video_thread.message_loop_proxy(), 233 NULL,
234 main_message_loop.message_loop_proxy(), 234 video_thread.message_loop_proxy(),
235 media::cast::GetDefaultCastLoggingConfig())); 235 main_message_loop.message_loop_proxy(),
236 media::cast::GetDefaultCastReceiverLoggingConfig()));
236 237
237 media::cast::AudioReceiverConfig audio_config = 238 media::cast::AudioReceiverConfig audio_config =
238 media::cast::GetAudioReceiverConfig(); 239 media::cast::GetAudioReceiverConfig();
239 media::cast::VideoReceiverConfig video_config = 240 media::cast::VideoReceiverConfig video_config =
240 media::cast::GetVideoReceiverConfig(); 241 media::cast::GetVideoReceiverConfig();
241 242
242 int remote_port, local_port; 243 int remote_port, local_port;
243 media::cast::GetPorts(&remote_port, &local_port); 244 media::cast::GetPorts(&remote_port, &local_port);
244 if (!local_port) { 245 if (!local_port) {
245 LOG(ERROR) << "Invalid local port."; 246 LOG(ERROR) << "Invalid local port.";
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 cast_receiver->packet_receiver(); 281 cast_receiver->packet_receiver();
281 282
282 transport->StartReceiving(packet_receiver); 283 transport->StartReceiving(packet_receiver);
283 284
284 scoped_refptr<media::cast::ReceiveProcess> receive_process( 285 scoped_refptr<media::cast::ReceiveProcess> receive_process(
285 new media::cast::ReceiveProcess(cast_receiver->frame_receiver())); 286 new media::cast::ReceiveProcess(cast_receiver->frame_receiver()));
286 receive_process->Start(); 287 receive_process->Start();
287 main_message_loop.Run(); 288 main_message_loop.Run();
288 return 0; 289 return 0;
289 } 290 }
OLDNEW
« no previous file with comments | « media/cast/test/end2end_unittest.cc ('k') | media/cast/test/sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698