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

Side by Side Diff: chrome/browser/extensions/api/cast_streaming/performance_test.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // Close to zero is better. (can be negative) 229 // Close to zero is better. (can be negative)
230 MeanAndError(deltas).Print(name, modifier, "av_sync", "ms"); 230 MeanAndError(deltas).Print(name, modifier, "av_sync", "ms");
231 // lower is better. 231 // lower is better.
232 AnalyzeJitter(audio_events_).Print(name, modifier, "audio_jitter", "ms"); 232 AnalyzeJitter(audio_events_).Print(name, modifier, "audio_jitter", "ms");
233 // lower is better. 233 // lower is better.
234 AnalyzeJitter(video_events_).Print(name, modifier, "video_jitter", "ms"); 234 AnalyzeJitter(video_events_).Print(name, modifier, "video_jitter", "ms");
235 } 235 }
236 236
237 private: 237 private:
238 // Invoked by InProcessReceiver for each received audio frame. 238 // Invoked by InProcessReceiver for each received audio frame.
239 void OnAudioFrame(scoped_ptr<media::AudioBus> audio_frame, 239 void OnAudioFrame(std::unique_ptr<media::AudioBus> audio_frame,
240 const base::TimeTicks& playout_time, 240 const base::TimeTicks& playout_time,
241 bool is_continuous) override { 241 bool is_continuous) override {
242 CHECK(cast_env()->CurrentlyOn(media::cast::CastEnvironment::MAIN)); 242 CHECK(cast_env()->CurrentlyOn(media::cast::CastEnvironment::MAIN));
243 243
244 if (audio_frame->frames() <= 0) { 244 if (audio_frame->frames() <= 0) {
245 NOTREACHED() << "OnAudioFrame called with no samples?!?"; 245 NOTREACHED() << "OnAudioFrame called with no samples?!?";
246 return; 246 return;
247 } 247 }
248 248
249 // Note: This is the number of the video frame that this audio belongs to. 249 // Note: This is the number of the video frame that this audio belongs to.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 if (HasFlag(k60fps)) 328 if (HasFlag(k60fps))
329 return 60; 329 return 60;
330 NOTREACHED(); 330 NOTREACHED();
331 return 0; 331 return 0;
332 } 332 }
333 333
334 net::IPEndPoint GetFreeLocalPort() { 334 net::IPEndPoint GetFreeLocalPort() {
335 // Determine a unused UDP port for the in-process receiver to listen on. 335 // Determine a unused UDP port for the in-process receiver to listen on.
336 // Method: Bind a UDP socket on port 0, and then check which port the 336 // Method: Bind a UDP socket on port 0, and then check which port the
337 // operating system assigned to it. 337 // operating system assigned to it.
338 scoped_ptr<net::UDPServerSocket> receive_socket( 338 std::unique_ptr<net::UDPServerSocket> receive_socket(
339 new net::UDPServerSocket(NULL, net::NetLog::Source())); 339 new net::UDPServerSocket(NULL, net::NetLog::Source()));
340 receive_socket->AllowAddressReuse(); 340 receive_socket->AllowAddressReuse();
341 CHECK_EQ(net::OK, receive_socket->Listen( 341 CHECK_EQ(net::OK, receive_socket->Listen(
342 net::IPEndPoint(net::IPAddress::IPv4Localhost(), 0))); 342 net::IPEndPoint(net::IPAddress::IPv4Localhost(), 0)));
343 net::IPEndPoint endpoint; 343 net::IPEndPoint endpoint;
344 CHECK_EQ(net::OK, receive_socket->GetLocalAddress(&endpoint)); 344 CHECK_EQ(net::OK, receive_socket->GetLocalAddress(&endpoint));
345 return endpoint; 345 return endpoint;
346 } 346 }
347 347
348 void SetUp() override { 348 void SetUp() override {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 } 578 }
579 if (HasFlag(kSlowClock)) { 579 if (HasFlag(kSlowClock)) {
580 delta = base::TimeDelta::FromSeconds(-10); 580 delta = base::TimeDelta::FromSeconds(-10);
581 } 581 }
582 scoped_refptr<media::cast::StandaloneCastEnvironment> cast_environment( 582 scoped_refptr<media::cast::StandaloneCastEnvironment> cast_environment(
583 new SkewedCastEnvironment(delta)); 583 new SkewedCastEnvironment(delta));
584 TestPatternReceiver* const receiver = 584 TestPatternReceiver* const receiver =
585 new TestPatternReceiver(cast_environment, receiver_end_point); 585 new TestPatternReceiver(cast_environment, receiver_end_point);
586 receiver->Start(); 586 receiver->Start();
587 587
588 scoped_ptr<media::cast::test::UDPProxy> udp_proxy; 588 std::unique_ptr<media::cast::test::UDPProxy> udp_proxy;
589 if (HasFlag(kProxyWifi) || HasFlag(kProxyBad)) { 589 if (HasFlag(kProxyWifi) || HasFlag(kProxyBad)) {
590 net::IPEndPoint proxy_end_point = GetFreeLocalPort(); 590 net::IPEndPoint proxy_end_point = GetFreeLocalPort();
591 if (HasFlag(kProxyWifi)) { 591 if (HasFlag(kProxyWifi)) {
592 udp_proxy = media::cast::test::UDPProxy::Create( 592 udp_proxy = media::cast::test::UDPProxy::Create(
593 proxy_end_point, receiver_end_point, 593 proxy_end_point, receiver_end_point,
594 media::cast::test::WifiNetwork(), media::cast::test::WifiNetwork(), 594 media::cast::test::WifiNetwork(), media::cast::test::WifiNetwork(),
595 NULL); 595 NULL);
596 } else if (HasFlag(kProxyBad)) { 596 } else if (HasFlag(kProxyBad)) {
597 udp_proxy = media::cast::test::UDPProxy::Create( 597 udp_proxy = media::cast::test::UDPProxy::Create(
598 proxy_end_point, receiver_end_point, 598 proxy_end_point, receiver_end_point,
(...skipping 10 matching lines...) Expand all
609 "performance%d.html?port=%d", 609 "performance%d.html?port=%d",
610 getfps(), 610 getfps(),
611 receiver_end_point.port()); 611 receiver_end_point.port());
612 ASSERT_TRUE(RunExtensionSubtest("cast_streaming", page_url)) << message_; 612 ASSERT_TRUE(RunExtensionSubtest("cast_streaming", page_url)) << message_;
613 ASSERT_TRUE(tracing::EndTracing(&json_events)); 613 ASSERT_TRUE(tracing::EndTracing(&json_events));
614 receiver->Stop(); 614 receiver->Stop();
615 615
616 // Stop all threads, removes the need for synchronization when analyzing 616 // Stop all threads, removes the need for synchronization when analyzing
617 // the data. 617 // the data.
618 cast_environment->Shutdown(); 618 cast_environment->Shutdown();
619 scoped_ptr<trace_analyzer::TraceAnalyzer> analyzer; 619 std::unique_ptr<trace_analyzer::TraceAnalyzer> analyzer;
620 analyzer.reset(trace_analyzer::TraceAnalyzer::Create(json_events)); 620 analyzer.reset(trace_analyzer::TraceAnalyzer::Create(json_events));
621 analyzer->AssociateAsyncBeginEndEvents(); 621 analyzer->AssociateAsyncBeginEndEvents();
622 622
623 MeanAndError frame_data = AnalyzeTraceDistance( 623 MeanAndError frame_data = AnalyzeTraceDistance(
624 analyzer.get(), 624 analyzer.get(),
625 "OnSwapCompositorFrame"); 625 "OnSwapCompositorFrame");
626 626
627 EXPECT_GT(frame_data.num_values, 0UL); 627 EXPECT_GT(frame_data.num_values, 0UL);
628 // Lower is better. 628 // Lower is better.
629 frame_data.Print(test_name, 629 frame_data.Print(test_name,
(...skipping 30 matching lines...) Expand all
660 CastV2PerformanceTest, 660 CastV2PerformanceTest,
661 testing::Values( 661 testing::Values(
662 kUseGpu | k24fps, 662 kUseGpu | k24fps,
663 kUseGpu | k30fps, 663 kUseGpu | k30fps,
664 kUseGpu | k60fps, 664 kUseGpu | k60fps,
665 kUseGpu | k24fps | kDisableVsync, 665 kUseGpu | k24fps | kDisableVsync,
666 kUseGpu | k30fps | kProxyWifi, 666 kUseGpu | k30fps | kProxyWifi,
667 kUseGpu | k30fps | kProxyBad, 667 kUseGpu | k30fps | kProxyBad,
668 kUseGpu | k30fps | kSlowClock, 668 kUseGpu | k30fps | kSlowClock,
669 kUseGpu | k30fps | kFastClock)); 669 kUseGpu | k30fps | kFastClock));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698