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 <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 |
11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
17 #include "base/time/default_tick_clock.h" | 17 #include "base/time/default_tick_clock.h" |
| 18 #include "media/base/video_frame.h" |
18 #include "media/cast/cast_config.h" | 19 #include "media/cast/cast_config.h" |
19 #include "media/cast/cast_environment.h" | 20 #include "media/cast/cast_environment.h" |
20 #include "media/cast/cast_receiver.h" | 21 #include "media/cast/cast_receiver.h" |
21 #include "media/cast/logging/logging_defines.h" | 22 #include "media/cast/logging/logging_defines.h" |
22 #include "media/cast/test/transport/transport.h" | 23 #include "media/cast/test/transport/transport.h" |
23 #include "media/cast/test/utility/input_helper.h" | 24 #include "media/cast/test/utility/input_helper.h" |
24 | 25 |
25 #if defined(OS_LINUX) | 26 #if defined(OS_LINUX) |
26 #include "media/cast/test/linux_output_window.h" | 27 #include "media/cast/test/linux_output_window.h" |
27 #endif // OS_LINUX | 28 #endif // OS_LINUX |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 GetAudioFrame(base::TimeDelta::FromMilliseconds(kFrameTimerMs)); | 151 GetAudioFrame(base::TimeDelta::FromMilliseconds(kFrameTimerMs)); |
151 GetVideoFrame(); | 152 GetVideoFrame(); |
152 } | 153 } |
153 | 154 |
154 protected: | 155 protected: |
155 virtual ~ReceiveProcess() {} | 156 virtual ~ReceiveProcess() {} |
156 | 157 |
157 private: | 158 private: |
158 friend class base::RefCountedThreadSafe<ReceiveProcess>; | 159 friend class base::RefCountedThreadSafe<ReceiveProcess>; |
159 | 160 |
160 void DisplayFrame(scoped_ptr<I420VideoFrame> frame, | 161 void DisplayFrame(const scoped_refptr<media::VideoFrame>& video_frame, |
161 const base::TimeTicks& render_time) { | 162 const base::TimeTicks& render_time) { |
162 #ifdef OS_LINUX | 163 #ifdef OS_LINUX |
163 render_.RenderFrame(*frame); | 164 render_.RenderFrame(video_frame); |
164 #endif // OS_LINUX | 165 #endif // OS_LINUX |
165 // Print out the delta between frames. | 166 // Print out the delta between frames. |
166 if (!last_render_time_.is_null()){ | 167 if (!last_render_time_.is_null()){ |
167 base::TimeDelta time_diff = render_time - last_render_time_; | 168 base::TimeDelta time_diff = render_time - last_render_time_; |
168 VLOG(0) << " RenderDelay[mS] = " << time_diff.InMilliseconds(); | 169 VLOG(0) << " RenderDelay[mS] = " << time_diff.InMilliseconds(); |
169 } | 170 } |
170 last_render_time_ = render_time; | 171 last_render_time_ = render_time; |
171 GetVideoFrame(); | 172 GetVideoFrame(); |
172 } | 173 } |
173 | 174 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 receive_port); | 255 receive_port); |
255 transport->SetSendDestination(ip_address, send_to_port); | 256 transport->SetSendDestination(ip_address, send_to_port); |
256 | 257 |
257 scoped_refptr<media::cast::ReceiveProcess> receive_process( | 258 scoped_refptr<media::cast::ReceiveProcess> receive_process( |
258 new media::cast::ReceiveProcess(cast_receiver->frame_receiver())); | 259 new media::cast::ReceiveProcess(cast_receiver->frame_receiver())); |
259 receive_process->Start(); | 260 receive_process->Start(); |
260 main_message_loop.Run(); | 261 main_message_loop.Run(); |
261 transport->StopReceiving(); | 262 transport->StopReceiving(); |
262 return 0; | 263 return 0; |
263 } | 264 } |
OLD | NEW |