analyzer_helper.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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_ANALYZER_HELPER_H_
  11. #define TEST_PC_E2E_ANALYZER_HELPER_H_
  12. #include <map>
  13. #include <string>
  14. #include "api/test/track_id_stream_label_map.h"
  15. #include "rtc_base/synchronization/sequence_checker.h"
  16. #include "rtc_base/thread_annotations.h"
  17. namespace webrtc {
  18. namespace webrtc_pc_e2e {
  19. // This class is a utility that provides bookkeeping capabilities that
  20. // are useful to associate stats reports track_ids to the remote stream_id.
  21. // The framework will populate an instance of this class and it will pass
  22. // it to the Start method of Media Quality Analyzers.
  23. // An instance of AnalyzerHelper must only be accessed from a single
  24. // thread and since stats collection happens on the signaling thread,
  25. // both AddTrackToStreamMapping and GetStreamLabelFromTrackId must be
  26. // invoked from the signaling thread.
  27. class AnalyzerHelper : public TrackIdStreamLabelMap {
  28. public:
  29. AnalyzerHelper();
  30. void AddTrackToStreamMapping(std::string track_id, std::string stream_label);
  31. const std::string& GetStreamLabelFromTrackId(
  32. const std::string& track_id) const override;
  33. private:
  34. SequenceChecker signaling_sequence_checker_;
  35. std::map<std::string, std::string> track_to_stream_map_
  36. RTC_GUARDED_BY(signaling_sequence_checker_);
  37. };
  38. } // namespace webrtc_pc_e2e
  39. } // namespace webrtc
  40. #endif // TEST_PC_E2E_ANALYZER_HELPER_H_