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

Side by Side Diff: webrtc/video/video_quality_test.cc

Issue 1356933005: Fixing camera capture for video_loopback (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressing comments Created 5 years, 3 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 | « webrtc/video/video_quality_test.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 test::FrameGenerator::CreateScrollingInputFromYuvFiles( 670 test::FrameGenerator::CreateScrollingInputFromYuvFiles(
671 clock_, slides, kWidth, kHeight, params.common.width, 671 clock_, slides, kWidth, kHeight, params.common.width,
672 params.common.height, params.screenshare.scroll_duration * 1000, 672 params.common.height, params.screenshare.scroll_duration * 1000,
673 kPauseDurationMs)); 673 kPauseDurationMs));
674 } 674 }
675 } 675 }
676 676
677 void VideoQualityTest::CreateCapturer(const Params& params, 677 void VideoQualityTest::CreateCapturer(const Params& params,
678 VideoCaptureInput* input) { 678 VideoCaptureInput* input) {
679 if (params.screenshare.enabled) { 679 if (params.screenshare.enabled) {
680 frame_generator_capturer_.reset(new test::FrameGeneratorCapturer( 680 test::FrameGeneratorCapturer *frame_generator_capturer =
681 clock_, input, frame_generator_.release(), params.common.fps)); 681 new test::FrameGeneratorCapturer(
682 EXPECT_TRUE(frame_generator_capturer_->Init()); 682 clock_, input, frame_generator_.release(), params.common.fps);
683 EXPECT_TRUE(frame_generator_capturer->Init());
684 capturer_.reset(frame_generator_capturer);
683 } else { 685 } else {
684 if (params.video.clip_name.empty()) { 686 if (params.video.clip_name.empty()) {
685 frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create( 687 capturer_.reset(test::VideoCapturer::Create(
686 input, params.common.width, params.common.height, params.common.fps, 688 input, params.common.width, params.common.height, params.common.fps,
687 clock_)); 689 clock_));
688 EXPECT_TRUE(frame_generator_capturer_->Init());
689 } else { 690 } else {
690 frame_generator_capturer_.reset( 691 capturer_.reset(test::FrameGeneratorCapturer::CreateFromYuvFile(
691 test::FrameGeneratorCapturer::CreateFromYuvFile( 692 input, test::ResourcePath(params.video.clip_name, "yuv"),
692 input, test::ResourcePath(params.video.clip_name, "yuv"), 693 params.common.width, params.common.height, params.common.fps,
693 params.common.width, params.common.height, params.common.fps, 694 clock_));
694 clock_)); 695 ASSERT_TRUE(capturer_.get() != nullptr)
695 ASSERT_TRUE(frame_generator_capturer_.get() != nullptr)
696 << "Could not create capturer for " << params.video.clip_name 696 << "Could not create capturer for " << params.video.clip_name
697 << ".yuv. Is this resource file present?"; 697 << ".yuv. Is this resource file present?";
698 } 698 }
699 } 699 }
700 } 700 }
701 701
702 void VideoQualityTest::RunWithAnalyzer(const Params& params) { 702 void VideoQualityTest::RunWithAnalyzer(const Params& params) {
703 // TODO(ivica): Merge with RunWithRenderer and use a flag / argument to 703 // TODO(ivica): Merge with RunWithRenderer and use a flag / argument to
704 // differentiate between the analyzer and the renderer case. 704 // differentiate between the analyzer and the renderer case.
705 ValidateParams(params); 705 ValidateParams(params);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 738
739 if (params.screenshare.enabled) 739 if (params.screenshare.enabled)
740 SetupScreenshare(params); 740 SetupScreenshare(params);
741 741
742 CreateCapturer(params, &analyzer); 742 CreateCapturer(params, &analyzer);
743 743
744 CreateStreams(); 744 CreateStreams();
745 analyzer.input_ = send_stream_->Input(); 745 analyzer.input_ = send_stream_->Input();
746 analyzer.send_stream_ = send_stream_; 746 analyzer.send_stream_ = send_stream_;
747 747
748 Start(); 748 send_stream_->Start();
749 for (size_t i = 0; i < receive_streams_.size(); ++i)
750 receive_streams_[i]->Start();
751 capturer_->Start();
749 752
750 analyzer.Wait(); 753 analyzer.Wait();
751 754
752 send_transport.StopSending(); 755 send_transport.StopSending();
753 recv_transport.StopSending(); 756 recv_transport.StopSending();
754 757
755 Stop(); 758 capturer_->Stop();
759 for (size_t i = 0; i < receive_streams_.size(); ++i)
760 receive_streams_[i]->Stop();
761 send_stream_->Stop();
756 762
757 DestroyStreams(); 763 DestroyStreams();
758 764
759 if (graph_data_output_file) 765 if (graph_data_output_file)
760 fclose(graph_data_output_file); 766 fclose(graph_data_output_file);
761 } 767 }
762 768
763 void VideoQualityTest::RunWithVideoRenderer(const Params& params) { 769 void VideoQualityTest::RunWithVideoRenderer(const Params& params) {
764 ValidateParams(params); 770 ValidateParams(params);
765 771
(...skipping 26 matching lines...) Expand all
792 SetupScreenshare(params); 798 SetupScreenshare(params);
793 799
794 send_stream_ = call->CreateVideoSendStream(send_config_, encoder_config_); 800 send_stream_ = call->CreateVideoSendStream(send_config_, encoder_config_);
795 CreateCapturer(params, send_stream_->Input()); 801 CreateCapturer(params, send_stream_->Input());
796 802
797 VideoReceiveStream* receive_stream = 803 VideoReceiveStream* receive_stream =
798 call->CreateVideoReceiveStream(receive_configs_[0]); 804 call->CreateVideoReceiveStream(receive_configs_[0]);
799 805
800 receive_stream->Start(); 806 receive_stream->Start();
801 send_stream_->Start(); 807 send_stream_->Start();
802 frame_generator_capturer_->Start(); 808 capturer_->Start();
803 809
804 test::PressEnterToContinue(); 810 test::PressEnterToContinue();
805 811
806 frame_generator_capturer_->Stop(); 812 capturer_->Stop();
807 send_stream_->Stop(); 813 send_stream_->Stop();
808 receive_stream->Stop(); 814 receive_stream->Stop();
809 815
810 call->DestroyVideoReceiveStream(receive_stream); 816 call->DestroyVideoReceiveStream(receive_stream);
811 call->DestroyVideoSendStream(send_stream_); 817 call->DestroyVideoSendStream(send_stream_);
812 818
813 transport.StopSending(); 819 transport.StopSending();
814 } 820 }
815 821
816 } // namespace webrtc 822 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_quality_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698