Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 test::FrameGeneratorCapturer *frame_generator_capturer = |
| 691 test::FrameGeneratorCapturer::CreateFromYuvFile( | 692 test::FrameGeneratorCapturer::CreateFromYuvFile( |
| 692 input, test::ResourcePath(params.video.clip_name, "yuv"), | 693 input, test::ResourcePath(params.video.clip_name, "yuv"), |
| 693 params.common.width, params.common.height, params.common.fps, | 694 params.common.width, params.common.height, params.common.fps, |
| 694 clock_)); | 695 clock_); |
| 695 ASSERT_TRUE(frame_generator_capturer_.get() != nullptr) | 696 ASSERT_TRUE(frame_generator_capturer != nullptr) |
| 696 << "Could not create capturer for " << params.video.clip_name | 697 << "Could not create capturer for " << params.video.clip_name |
| 697 << ".yuv. Is this resource file present?"; | 698 << ".yuv. Is this resource file present?"; |
| 699 capturer_.reset(frame_generator_capturer); | |
|
pbos-webrtc
2015/09/22 11:26:10
Just do capturer_.reset(.. above and assert that c
ivica
2015/09/22 11:35:59
Done.
| |
| 698 } | 700 } |
| 699 } | 701 } |
| 700 } | 702 } |
| 701 | 703 |
| 702 void VideoQualityTest::RunWithAnalyzer(const Params& params) { | 704 void VideoQualityTest::RunWithAnalyzer(const Params& params) { |
| 703 // TODO(ivica): Merge with RunWithRenderer and use a flag / argument to | 705 // TODO(ivica): Merge with RunWithRenderer and use a flag / argument to |
| 704 // differentiate between the analyzer and the renderer case. | 706 // differentiate between the analyzer and the renderer case. |
| 705 ValidateParams(params); | 707 ValidateParams(params); |
| 706 | 708 |
| 707 FILE* graph_data_output_file = nullptr; | 709 FILE* graph_data_output_file = nullptr; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 738 | 740 |
| 739 if (params.screenshare.enabled) | 741 if (params.screenshare.enabled) |
| 740 SetupScreenshare(params); | 742 SetupScreenshare(params); |
| 741 | 743 |
| 742 CreateCapturer(params, &analyzer); | 744 CreateCapturer(params, &analyzer); |
| 743 | 745 |
| 744 CreateStreams(); | 746 CreateStreams(); |
| 745 analyzer.input_ = send_stream_->Input(); | 747 analyzer.input_ = send_stream_->Input(); |
| 746 analyzer.send_stream_ = send_stream_; | 748 analyzer.send_stream_ = send_stream_; |
| 747 | 749 |
| 748 Start(); | 750 send_stream_->Start(); |
| 751 for (size_t i = 0; i < receive_streams_.size(); ++i) | |
| 752 receive_streams_[i]->Start(); | |
| 753 capturer_->Start(); | |
| 749 | 754 |
| 750 analyzer.Wait(); | 755 analyzer.Wait(); |
| 751 | 756 |
| 752 send_transport.StopSending(); | 757 send_transport.StopSending(); |
| 753 recv_transport.StopSending(); | 758 recv_transport.StopSending(); |
| 754 | 759 |
| 755 Stop(); | 760 capturer_->Stop(); |
| 761 for (size_t i = 0; i < receive_streams_.size(); ++i) | |
| 762 receive_streams_[i]->Stop(); | |
| 763 send_stream_->Stop(); | |
| 756 | 764 |
| 757 DestroyStreams(); | 765 DestroyStreams(); |
| 758 | 766 |
| 759 if (graph_data_output_file) | 767 if (graph_data_output_file) |
| 760 fclose(graph_data_output_file); | 768 fclose(graph_data_output_file); |
| 761 } | 769 } |
| 762 | 770 |
| 763 void VideoQualityTest::RunWithVideoRenderer(const Params& params) { | 771 void VideoQualityTest::RunWithVideoRenderer(const Params& params) { |
| 764 ValidateParams(params); | 772 ValidateParams(params); |
| 765 | 773 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 792 SetupScreenshare(params); | 800 SetupScreenshare(params); |
| 793 | 801 |
| 794 send_stream_ = call->CreateVideoSendStream(send_config_, encoder_config_); | 802 send_stream_ = call->CreateVideoSendStream(send_config_, encoder_config_); |
| 795 CreateCapturer(params, send_stream_->Input()); | 803 CreateCapturer(params, send_stream_->Input()); |
| 796 | 804 |
| 797 VideoReceiveStream* receive_stream = | 805 VideoReceiveStream* receive_stream = |
| 798 call->CreateVideoReceiveStream(receive_configs_[0]); | 806 call->CreateVideoReceiveStream(receive_configs_[0]); |
| 799 | 807 |
| 800 receive_stream->Start(); | 808 receive_stream->Start(); |
| 801 send_stream_->Start(); | 809 send_stream_->Start(); |
| 802 frame_generator_capturer_->Start(); | 810 capturer_->Start(); |
| 803 | 811 |
| 804 test::PressEnterToContinue(); | 812 test::PressEnterToContinue(); |
| 805 | 813 |
| 806 frame_generator_capturer_->Stop(); | 814 capturer_->Stop(); |
| 807 send_stream_->Stop(); | 815 send_stream_->Stop(); |
| 808 receive_stream->Stop(); | 816 receive_stream->Stop(); |
| 809 | 817 |
| 810 call->DestroyVideoReceiveStream(receive_stream); | 818 call->DestroyVideoReceiveStream(receive_stream); |
| 811 call->DestroyVideoSendStream(send_stream_); | 819 call->DestroyVideoSendStream(send_stream_); |
| 812 | 820 |
| 813 transport.StopSending(); | 821 transport.StopSending(); |
| 814 } | 822 } |
| 815 | 823 |
| 816 } // namespace webrtc | 824 } // namespace webrtc |
| OLD | NEW |