1 /*
2  *  Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef TEST_PC_E2E_MEDIA_MEDIA_HELPER_H_
12 #define TEST_PC_E2E_MEDIA_MEDIA_HELPER_H_
13 
14 #include <memory>
15 #include <vector>
16 
17 #include "api/test/frame_generator_interface.h"
18 #include "api/test/peerconnection_quality_test_fixture.h"
19 #include "test/pc/e2e/analyzer/video/video_quality_analyzer_injection_helper.h"
20 #include "test/pc/e2e/media/test_video_capturer_video_track_source.h"
21 #include "test/pc/e2e/peer_configurer.h"
22 #include "test/pc/e2e/test_peer.h"
23 
24 namespace webrtc {
25 namespace webrtc_pc_e2e {
26 
27 class MediaHelper {
28  public:
MediaHelper(VideoQualityAnalyzerInjectionHelper * video_quality_analyzer_injection_helper,TaskQueueFactory * task_queue_factory)29   MediaHelper(VideoQualityAnalyzerInjectionHelper*
30                   video_quality_analyzer_injection_helper,
31               TaskQueueFactory* task_queue_factory)
32       : clock_(Clock::GetRealTimeClock()),
33         task_queue_factory_(task_queue_factory),
34         video_quality_analyzer_injection_helper_(
35             video_quality_analyzer_injection_helper) {}
36 
37   void MaybeAddAudio(TestPeer* peer);
38 
39   std::vector<rtc::scoped_refptr<TestVideoCapturerVideoTrackSource>>
40   MaybeAddVideo(TestPeer* peer);
41 
42  private:
43   std::unique_ptr<test::TestVideoCapturer> CreateVideoCapturer(
44       const PeerConnectionE2EQualityTestFixture::VideoConfig& video_config,
45       PeerConfigurerImpl::VideoSource source,
46       std::unique_ptr<test::TestVideoCapturer::FramePreprocessor>
47           frame_preprocessor);
48 
49   Clock* const clock_;
50   TaskQueueFactory* const task_queue_factory_;
51   VideoQualityAnalyzerInjectionHelper* video_quality_analyzer_injection_helper_;
52 };
53 
54 }  // namespace webrtc_pc_e2e
55 }  // namespace webrtc
56 
57 #endif  // TEST_PC_E2E_MEDIA_MEDIA_HELPER_H_
58