xref: /aosp_15_r20/external/webrtc/test/pc/e2e/media/media_helper.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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/pclf/media_configuration.h"
19 #include "api/test/pclf/peer_configurer.h"
20 #include "test/pc/e2e/analyzer/video/video_quality_analyzer_injection_helper.h"
21 #include "test/pc/e2e/media/test_video_capturer_video_track_source.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,Clock * clock)29   MediaHelper(VideoQualityAnalyzerInjectionHelper*
30                   video_quality_analyzer_injection_helper,
31               TaskQueueFactory* task_queue_factory,
32               Clock* clock)
33       : clock_(clock),
34         task_queue_factory_(task_queue_factory),
35         video_quality_analyzer_injection_helper_(
36             video_quality_analyzer_injection_helper) {}
37 
38   void MaybeAddAudio(TestPeer* peer);
39 
40   std::vector<rtc::scoped_refptr<TestVideoCapturerVideoTrackSource>>
41   MaybeAddVideo(TestPeer* peer);
42 
43  private:
44   std::unique_ptr<test::TestVideoCapturer> CreateVideoCapturer(
45       const VideoConfig& video_config,
46       PeerConfigurer::VideoSource source,
47       std::unique_ptr<test::TestVideoCapturer::FramePreprocessor>
48           frame_preprocessor);
49 
50   Clock* const clock_;
51   TaskQueueFactory* const task_queue_factory_;
52   VideoQualityAnalyzerInjectionHelper* video_quality_analyzer_injection_helper_;
53 };
54 
55 }  // namespace webrtc_pc_e2e
56 }  // namespace webrtc
57 
58 #endif  // TEST_PC_E2E_MEDIA_MEDIA_HELPER_H_
59