test_peer.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (c) 2019 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. #ifndef TEST_PC_E2E_TEST_PEER_H_
  11. #define TEST_PC_E2E_TEST_PEER_H_
  12. #include <memory>
  13. #include <vector>
  14. #include "absl/memory/memory.h"
  15. #include "absl/types/variant.h"
  16. #include "api/test/frame_generator_interface.h"
  17. #include "api/test/peerconnection_quality_test_fixture.h"
  18. #include "pc/peer_connection_wrapper.h"
  19. #include "test/pc/e2e/peer_configurer.h"
  20. #include "test/pc/e2e/peer_connection_quality_test_params.h"
  21. namespace webrtc {
  22. namespace webrtc_pc_e2e {
  23. // Describes a single participant in the call.
  24. class TestPeer final : public PeerConnectionWrapper {
  25. public:
  26. using PeerConnectionWrapper::PeerConnectionWrapper;
  27. Params* params() const { return params_.get(); }
  28. PeerConfigurerImpl::VideoSource ReleaseVideoSource(size_t i) {
  29. return std::move(video_sources_[i]);
  30. }
  31. void DetachAecDump() {
  32. if (audio_processing_) {
  33. audio_processing_->DetachAecDump();
  34. }
  35. }
  36. // Adds provided |candidates| to the owned peer connection.
  37. bool AddIceCandidates(
  38. std::vector<std::unique_ptr<IceCandidateInterface>> candidates);
  39. protected:
  40. friend class TestPeerFactory;
  41. TestPeer(rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory,
  42. rtc::scoped_refptr<PeerConnectionInterface> pc,
  43. std::unique_ptr<MockPeerConnectionObserver> observer,
  44. std::unique_ptr<Params> params,
  45. std::vector<PeerConfigurerImpl::VideoSource> video_sources,
  46. rtc::scoped_refptr<AudioProcessing> audio_processing);
  47. private:
  48. std::unique_ptr<Params> params_;
  49. std::vector<PeerConfigurerImpl::VideoSource> video_sources_;
  50. rtc::scoped_refptr<AudioProcessing> audio_processing_;
  51. std::vector<std::unique_ptr<IceCandidateInterface>> remote_ice_candidates_;
  52. };
  53. } // namespace webrtc_pc_e2e
  54. } // namespace webrtc
  55. #endif // TEST_PC_E2E_TEST_PEER_H_