| 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 <map> | 5 #include <map> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #if defined(OS_MACOSX) | 10 #if defined(OS_MACOSX) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 kProxyWifi = 1 << 6, // Run UDP through UDPProxy wifi profile | 74 kProxyWifi = 1 << 6, // Run UDP through UDPProxy wifi profile |
| 75 kProxyBad = 1 << 7, // Run UDP through UDPProxy bad profile | 75 kProxyBad = 1 << 7, // Run UDP through UDPProxy bad profile |
| 76 kSlowClock = 1 << 8, // Receiver clock is 10 seconds slow | 76 kSlowClock = 1 << 8, // Receiver clock is 10 seconds slow |
| 77 kFastClock = 1 << 9, // Receiver clock is 10 seconds fast | 77 kFastClock = 1 << 9, // Receiver clock is 10 seconds fast |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 class SkewedTickClock : public base::DefaultTickClock { | 80 class SkewedTickClock : public base::DefaultTickClock { |
| 81 public: | 81 public: |
| 82 explicit SkewedTickClock(const base::TimeDelta& delta) : delta_(delta) { | 82 explicit SkewedTickClock(const base::TimeDelta& delta) : delta_(delta) { |
| 83 } | 83 } |
| 84 virtual base::TimeTicks NowTicks() OVERRIDE { | 84 virtual base::TimeTicks NowTicks() override { |
| 85 return DefaultTickClock::NowTicks() + delta_; | 85 return DefaultTickClock::NowTicks() + delta_; |
| 86 } | 86 } |
| 87 private: | 87 private: |
| 88 base::TimeDelta delta_; | 88 base::TimeDelta delta_; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 class SkewedCastEnvironment : public media::cast::StandaloneCastEnvironment { | 91 class SkewedCastEnvironment : public media::cast::StandaloneCastEnvironment { |
| 92 public: | 92 public: |
| 93 explicit SkewedCastEnvironment(const base::TimeDelta& delta) : | 93 explicit SkewedCastEnvironment(const base::TimeDelta& delta) : |
| 94 StandaloneCastEnvironment() { | 94 StandaloneCastEnvironment() { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // lower is better. | 234 // lower is better. |
| 235 AnalyzeJitter(audio_events_).Print(name, modifier, "audio_jitter", "ms"); | 235 AnalyzeJitter(audio_events_).Print(name, modifier, "audio_jitter", "ms"); |
| 236 // lower is better. | 236 // lower is better. |
| 237 AnalyzeJitter(video_events_).Print(name, modifier, "video_jitter", "ms"); | 237 AnalyzeJitter(video_events_).Print(name, modifier, "video_jitter", "ms"); |
| 238 } | 238 } |
| 239 | 239 |
| 240 private: | 240 private: |
| 241 // Invoked by InProcessReceiver for each received audio frame. | 241 // Invoked by InProcessReceiver for each received audio frame. |
| 242 virtual void OnAudioFrame(scoped_ptr<media::AudioBus> audio_frame, | 242 virtual void OnAudioFrame(scoped_ptr<media::AudioBus> audio_frame, |
| 243 const base::TimeTicks& playout_time, | 243 const base::TimeTicks& playout_time, |
| 244 bool is_continuous) OVERRIDE { | 244 bool is_continuous) override { |
| 245 CHECK(cast_env()->CurrentlyOn(media::cast::CastEnvironment::MAIN)); | 245 CHECK(cast_env()->CurrentlyOn(media::cast::CastEnvironment::MAIN)); |
| 246 | 246 |
| 247 if (audio_frame->frames() <= 0) { | 247 if (audio_frame->frames() <= 0) { |
| 248 NOTREACHED() << "OnAudioFrame called with no samples?!?"; | 248 NOTREACHED() << "OnAudioFrame called with no samples?!?"; |
| 249 return; | 249 return; |
| 250 } | 250 } |
| 251 | 251 |
| 252 // Note: This is the number of the video frame that this audio belongs to. | 252 // Note: This is the number of the video frame that this audio belongs to. |
| 253 uint16 frame_no; | 253 uint16 frame_no; |
| 254 if (media::cast::DecodeTimestamp(audio_frame->channel(0), | 254 if (media::cast::DecodeTimestamp(audio_frame->channel(0), |
| 255 audio_frame->frames(), | 255 audio_frame->frames(), |
| 256 &frame_no)) { | 256 &frame_no)) { |
| 257 audio_events_.push_back(TimeData(frame_no, playout_time)); | 257 audio_events_.push_back(TimeData(frame_no, playout_time)); |
| 258 } else { | 258 } else { |
| 259 VLOG(0) << "Failed to decode audio timestamp!"; | 259 VLOG(0) << "Failed to decode audio timestamp!"; |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| 263 virtual void OnVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, | 263 virtual void OnVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, |
| 264 const base::TimeTicks& render_time, | 264 const base::TimeTicks& render_time, |
| 265 bool is_continuous) OVERRIDE { | 265 bool is_continuous) override { |
| 266 CHECK(cast_env()->CurrentlyOn(media::cast::CastEnvironment::MAIN)); | 266 CHECK(cast_env()->CurrentlyOn(media::cast::CastEnvironment::MAIN)); |
| 267 | 267 |
| 268 TRACE_EVENT_INSTANT1( | 268 TRACE_EVENT_INSTANT1( |
| 269 "mirroring", "TestPatternReceiver::OnVideoFrame", | 269 "mirroring", "TestPatternReceiver::OnVideoFrame", |
| 270 TRACE_EVENT_SCOPE_THREAD, | 270 TRACE_EVENT_SCOPE_THREAD, |
| 271 "render_time", render_time.ToInternalValue()); | 271 "render_time", render_time.ToInternalValue()); |
| 272 | 272 |
| 273 uint16 frame_no; | 273 uint16 frame_no; |
| 274 if (media::cast::test::DecodeBarcode(video_frame, &frame_no)) { | 274 if (media::cast::test::DecodeBarcode(video_frame, &frame_no)) { |
| 275 video_events_.push_back(TimeData(frame_no, render_time)); | 275 video_events_.push_back(TimeData(frame_no, render_time)); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 net::RandIntCallback(), | 348 net::RandIntCallback(), |
| 349 NULL, | 349 NULL, |
| 350 net::NetLog::Source())); | 350 net::NetLog::Source())); |
| 351 receive_socket->AllowAddressReuse(); | 351 receive_socket->AllowAddressReuse(); |
| 352 CHECK_EQ(net::OK, receive_socket->Bind(net::IPEndPoint(localhost, 0))); | 352 CHECK_EQ(net::OK, receive_socket->Bind(net::IPEndPoint(localhost, 0))); |
| 353 net::IPEndPoint endpoint; | 353 net::IPEndPoint endpoint; |
| 354 CHECK_EQ(net::OK, receive_socket->GetLocalAddress(&endpoint)); | 354 CHECK_EQ(net::OK, receive_socket->GetLocalAddress(&endpoint)); |
| 355 return endpoint; | 355 return endpoint; |
| 356 } | 356 } |
| 357 | 357 |
| 358 virtual void SetUp() OVERRIDE { | 358 virtual void SetUp() override { |
| 359 EnablePixelOutput(); | 359 EnablePixelOutput(); |
| 360 ExtensionApiTest::SetUp(); | 360 ExtensionApiTest::SetUp(); |
| 361 } | 361 } |
| 362 | 362 |
| 363 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 363 virtual void SetUpCommandLine(CommandLine* command_line) override { |
| 364 // Some of the tests may launch http requests through JSON or AJAX | 364 // Some of the tests may launch http requests through JSON or AJAX |
| 365 // which causes a security error (cross domain request) when the page | 365 // which causes a security error (cross domain request) when the page |
| 366 // is loaded from the local file system ( file:// ). The following switch | 366 // is loaded from the local file system ( file:// ). The following switch |
| 367 // fixes that error. | 367 // fixes that error. |
| 368 command_line->AppendSwitch(switches::kAllowFileAccessFromFiles); | 368 command_line->AppendSwitch(switches::kAllowFileAccessFromFiles); |
| 369 | 369 |
| 370 if (HasFlag(kSmallWindow)) { | 370 if (HasFlag(kSmallWindow)) { |
| 371 command_line->AppendSwitchASCII(switches::kWindowSize, "800,600"); | 371 command_line->AppendSwitchASCII(switches::kWindowSize, "800,600"); |
| 372 } else { | 372 } else { |
| 373 command_line->AppendSwitchASCII(switches::kWindowSize, "2000,1500"); | 373 command_line->AppendSwitchASCII(switches::kWindowSize, "2000,1500"); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 CastV2PerformanceTest, | 672 CastV2PerformanceTest, |
| 673 testing::Values( | 673 testing::Values( |
| 674 kUseGpu | k24fps, | 674 kUseGpu | k24fps, |
| 675 kUseGpu | k30fps, | 675 kUseGpu | k30fps, |
| 676 kUseGpu | k60fps, | 676 kUseGpu | k60fps, |
| 677 kUseGpu | k24fps | kDisableVsync, | 677 kUseGpu | k24fps | kDisableVsync, |
| 678 kUseGpu | k30fps | kProxyWifi, | 678 kUseGpu | k30fps | kProxyWifi, |
| 679 kUseGpu | k30fps | kProxyBad, | 679 kUseGpu | k30fps | kProxyBad, |
| 680 kUseGpu | k30fps | kSlowClock, | 680 kUseGpu | k30fps | kSlowClock, |
| 681 kUseGpu | k30fps | kFastClock)); | 681 kUseGpu | k30fps | kFastClock)); |
| OLD | NEW |