• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
11 #include "test/pc/e2e/analyzer_helper.h"
12 
13 #include <utility>
14 
15 namespace webrtc {
16 namespace webrtc_pc_e2e {
17 
AnalyzerHelper()18 AnalyzerHelper::AnalyzerHelper() {
19   signaling_sequence_checker_.Detach();
20 }
21 
AddTrackToStreamMapping(std::string track_id,std::string stream_label)22 void AnalyzerHelper::AddTrackToStreamMapping(std::string track_id,
23                                              std::string stream_label) {
24   RTC_DCHECK_RUN_ON(&signaling_sequence_checker_);
25   track_to_stream_map_.insert(
26       {std::move(track_id), StreamInfo{stream_label, stream_label}});
27 }
28 
AddTrackToStreamMapping(std::string track_id,std::string stream_label,std::string sync_group)29 void AnalyzerHelper::AddTrackToStreamMapping(std::string track_id,
30                                              std::string stream_label,
31                                              std::string sync_group) {
32   RTC_DCHECK_RUN_ON(&signaling_sequence_checker_);
33   track_to_stream_map_.insert(
34       {std::move(track_id),
35        StreamInfo{std::move(stream_label), std::move(sync_group)}});
36 }
37 
GetStreamInfoFromTrackId(absl::string_view track_id) const38 const AnalyzerHelper::StreamInfo& AnalyzerHelper::GetStreamInfoFromTrackId(
39     absl::string_view track_id) const {
40   RTC_DCHECK_RUN_ON(&signaling_sequence_checker_);
41   auto track_to_stream_pair = track_to_stream_map_.find(std::string(track_id));
42   RTC_CHECK(track_to_stream_pair != track_to_stream_map_.end());
43   return track_to_stream_pair->second;
44 }
45 
GetStreamLabelFromTrackId(absl::string_view track_id) const46 absl::string_view AnalyzerHelper::GetStreamLabelFromTrackId(
47     absl::string_view track_id) const {
48   return GetStreamInfoFromTrackId(track_id).stream_label;
49 }
50 
GetSyncGroupLabelFromTrackId(absl::string_view track_id) const51 absl::string_view AnalyzerHelper::GetSyncGroupLabelFromTrackId(
52     absl::string_view track_id) const {
53   return GetStreamInfoFromTrackId(track_id).sync_group;
54 }
55 
56 }  // namespace webrtc_pc_e2e
57 }  // namespace webrtc
58