blob: bffa3eb8661b16d445c243e1985c40cc364d5fb1 [file] [log] [blame]
hbos1f8239c2017-01-16 12:24:101/*
2 * Copyright 2016 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
Steve Anton10542f22019-01-11 17:11:0011#include "pc/track_media_info_map.h"
hbos1f8239c2017-01-16 12:24:1012
Harald Alvestrandc24a2182022-02-23 13:44:5913#include <stddef.h>
14
15#include <cstdint>
hbos1f8239c2017-01-16 12:24:1016#include <initializer_list>
Steve Anton5dfde182018-02-06 18:34:4017#include <string>
Harald Alvestrandc24a2182022-02-23 13:44:5918#include <type_traits>
hbos1f8239c2017-01-16 12:24:1019#include <utility>
20#include <vector>
21
Harald Alvestrandc24a2182022-02-23 13:44:5922#include "api/media_types.h"
23#include "api/rtp_parameters.h"
Florent Castelli63cc46c2021-07-16 23:32:4024#include "api/test/mock_video_track.h"
Steve Anton10542f22019-01-11 17:11:0025#include "media/base/media_channel.h"
26#include "pc/audio_track.h"
27#include "pc/test/fake_video_track_source.h"
28#include "pc/test/mock_rtp_receiver_internal.h"
29#include "pc/test/mock_rtp_sender_internal.h"
30#include "pc/video_track.h"
Harald Alvestrandc24a2182022-02-23 13:44:5931#include "rtc_base/checks.h"
Harald Alvestrandc24a2182022-02-23 13:44:5932#include "rtc_base/thread.h"
33#include "test/gmock.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3134#include "test/gtest.h"
hbos1f8239c2017-01-16 12:24:1035
Henrik Boströmfc67b452022-07-27 08:55:4536using ::testing::ElementsAre;
37
hbos1f8239c2017-01-16 12:24:1038namespace webrtc {
39
40namespace {
41
42RtpParameters CreateRtpParametersWithSsrcs(
43 std::initializer_list<uint32_t> ssrcs) {
44 RtpParameters params;
45 for (uint32_t ssrc : ssrcs) {
46 RtpEncodingParameters encoding_params;
Oskar Sundbom36f8f3e2017-11-16 09:54:2747 encoding_params.ssrc = ssrc;
hbos1f8239c2017-01-16 12:24:1048 params.encodings.push_back(encoding_params);
49 }
50 return params;
51}
52
Steve Anton57858b32018-02-15 23:19:5053rtc::scoped_refptr<MockRtpSenderInternal> CreateMockRtpSender(
deadbeef804c1af2017-02-12 03:07:3154 cricket::MediaType media_type,
55 std::initializer_list<uint32_t> ssrcs,
hbos1f8239c2017-01-16 12:24:1056 rtc::scoped_refptr<MediaStreamTrackInterface> track) {
57 uint32_t first_ssrc;
58 if (ssrcs.size()) {
59 first_ssrc = *ssrcs.begin();
60 } else {
61 first_ssrc = 0;
62 }
Tommi87f70902021-04-27 12:43:0863 auto sender = rtc::make_ref_counted<MockRtpSenderInternal>();
Mirko Bonadeic61ce0d2017-11-21 16:04:2064 EXPECT_CALL(*sender, track())
Mirko Bonadei6a489f22019-04-09 13:11:1265 .WillRepeatedly(::testing::Return(std::move(track)));
66 EXPECT_CALL(*sender, ssrc()).WillRepeatedly(::testing::Return(first_ssrc));
deadbeef804c1af2017-02-12 03:07:3167 EXPECT_CALL(*sender, media_type())
Mirko Bonadei6a489f22019-04-09 13:11:1268 .WillRepeatedly(::testing::Return(media_type));
deadbeef804c1af2017-02-12 03:07:3169 EXPECT_CALL(*sender, GetParameters())
Mirko Bonadei6a489f22019-04-09 13:11:1270 .WillRepeatedly(::testing::Return(CreateRtpParametersWithSsrcs(ssrcs)));
71 EXPECT_CALL(*sender, AttachmentId()).WillRepeatedly(::testing::Return(1));
hbos1f8239c2017-01-16 12:24:1072 return sender;
73}
74
Steve Anton57858b32018-02-15 23:19:5075rtc::scoped_refptr<MockRtpReceiverInternal> CreateMockRtpReceiver(
deadbeef804c1af2017-02-12 03:07:3176 cricket::MediaType media_type,
77 std::initializer_list<uint32_t> ssrcs,
hbos1f8239c2017-01-16 12:24:1078 rtc::scoped_refptr<MediaStreamTrackInterface> track) {
Tommi87f70902021-04-27 12:43:0879 auto receiver = rtc::make_ref_counted<MockRtpReceiverInternal>();
Mirko Bonadeic61ce0d2017-11-21 16:04:2080 EXPECT_CALL(*receiver, track())
Mirko Bonadei6a489f22019-04-09 13:11:1281 .WillRepeatedly(::testing::Return(std::move(track)));
deadbeef804c1af2017-02-12 03:07:3182 EXPECT_CALL(*receiver, media_type())
Mirko Bonadei6a489f22019-04-09 13:11:1283 .WillRepeatedly(::testing::Return(media_type));
deadbeef804c1af2017-02-12 03:07:3184 EXPECT_CALL(*receiver, GetParameters())
Mirko Bonadei6a489f22019-04-09 13:11:1285 .WillRepeatedly(::testing::Return(CreateRtpParametersWithSsrcs(ssrcs)));
86 EXPECT_CALL(*receiver, AttachmentId()).WillRepeatedly(::testing::Return(1));
hbos1f8239c2017-01-16 12:24:1087 return receiver;
88}
89
Tommi816134a2021-05-24 14:54:4190rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack(
91 const std::string& id) {
92 return VideoTrack::Create(id, FakeVideoTrackSource::Create(false),
93 rtc::Thread::Current());
94}
95
96rtc::scoped_refptr<VideoTrackInterface> CreateMockVideoTrack(
97 const std::string& id) {
Florent Castelli63cc46c2021-07-16 23:32:4098 auto track = MockVideoTrack::Create();
Tommi816134a2021-05-24 14:54:4199 EXPECT_CALL(*track, kind())
100 .WillRepeatedly(::testing::Return(VideoTrack::kVideoKind));
101 return track;
102}
103
Mirko Bonadei6a489f22019-04-09 13:11:12104class TrackMediaInfoMapTest : public ::testing::Test {
hbos1f8239c2017-01-16 12:24:10105 public:
Tommiec3ba732020-05-17 12:33:40106 TrackMediaInfoMapTest() : TrackMediaInfoMapTest(true) {}
107
Tommi816134a2021-05-24 14:54:41108 explicit TrackMediaInfoMapTest(bool use_real_video_track)
Henrik Boströmfc67b452022-07-27 08:55:45109 : local_audio_track_(AudioTrack::Create("LocalAudioTrack", nullptr)),
hbos1f8239c2017-01-16 12:24:10110 remote_audio_track_(AudioTrack::Create("RemoteAudioTrack", nullptr)),
Tommi816134a2021-05-24 14:54:41111 local_video_track_(use_real_video_track
112 ? CreateVideoTrack("LocalVideoTrack")
113 : CreateMockVideoTrack("LocalVideoTrack")),
114 remote_video_track_(use_real_video_track
115 ? CreateVideoTrack("RemoteVideoTrack")
116 : CreateMockVideoTrack("LocalVideoTrack")) {}
hbos1f8239c2017-01-16 12:24:10117
hbos1f8239c2017-01-16 12:24:10118 void AddRtpSenderWithSsrcs(std::initializer_list<uint32_t> ssrcs,
119 MediaStreamTrackInterface* local_track) {
Steve Anton57858b32018-02-15 23:19:50120 rtc::scoped_refptr<MockRtpSenderInternal> rtp_sender = CreateMockRtpSender(
deadbeef804c1af2017-02-12 03:07:31121 local_track->kind() == MediaStreamTrackInterface::kAudioKind
122 ? cricket::MEDIA_TYPE_AUDIO
123 : cricket::MEDIA_TYPE_VIDEO,
Niels Möllere7cc8832022-01-04 14:20:03124 ssrcs, rtc::scoped_refptr<MediaStreamTrackInterface>(local_track));
hbos1f8239c2017-01-16 12:24:10125 rtp_senders_.push_back(rtp_sender);
126
127 if (local_track->kind() == MediaStreamTrackInterface::kAudioKind) {
128 cricket::VoiceSenderInfo voice_sender_info;
129 size_t i = 0;
130 for (uint32_t ssrc : ssrcs) {
131 voice_sender_info.local_stats.push_back(cricket::SsrcSenderInfo());
132 voice_sender_info.local_stats[i++].ssrc = ssrc;
133 }
Henrik Boströmfc67b452022-07-27 08:55:45134 voice_media_info_.senders.push_back(voice_sender_info);
hbos1f8239c2017-01-16 12:24:10135 } else {
136 cricket::VideoSenderInfo video_sender_info;
137 size_t i = 0;
138 for (uint32_t ssrc : ssrcs) {
139 video_sender_info.local_stats.push_back(cricket::SsrcSenderInfo());
140 video_sender_info.local_stats[i++].ssrc = ssrc;
141 }
Henrik Boströmfc67b452022-07-27 08:55:45142 video_media_info_.senders.push_back(video_sender_info);
143 video_media_info_.aggregated_senders.push_back(video_sender_info);
hbos1f8239c2017-01-16 12:24:10144 }
145 }
146
147 void AddRtpReceiverWithSsrcs(std::initializer_list<uint32_t> ssrcs,
148 MediaStreamTrackInterface* remote_track) {
Steve Anton57858b32018-02-15 23:19:50149 auto rtp_receiver = CreateMockRtpReceiver(
deadbeef804c1af2017-02-12 03:07:31150 remote_track->kind() == MediaStreamTrackInterface::kAudioKind
151 ? cricket::MEDIA_TYPE_AUDIO
152 : cricket::MEDIA_TYPE_VIDEO,
Niels Möllere7cc8832022-01-04 14:20:03153 ssrcs, rtc::scoped_refptr<MediaStreamTrackInterface>(remote_track));
hbos1f8239c2017-01-16 12:24:10154 rtp_receivers_.push_back(rtp_receiver);
155
156 if (remote_track->kind() == MediaStreamTrackInterface::kAudioKind) {
157 cricket::VoiceReceiverInfo voice_receiver_info;
158 size_t i = 0;
159 for (uint32_t ssrc : ssrcs) {
160 voice_receiver_info.local_stats.push_back(cricket::SsrcReceiverInfo());
161 voice_receiver_info.local_stats[i++].ssrc = ssrc;
162 }
Henrik Boströmfc67b452022-07-27 08:55:45163 voice_media_info_.receivers.push_back(voice_receiver_info);
hbos1f8239c2017-01-16 12:24:10164 } else {
165 cricket::VideoReceiverInfo video_receiver_info;
166 size_t i = 0;
167 for (uint32_t ssrc : ssrcs) {
168 video_receiver_info.local_stats.push_back(cricket::SsrcReceiverInfo());
169 video_receiver_info.local_stats[i++].ssrc = ssrc;
170 }
Henrik Boströmfc67b452022-07-27 08:55:45171 video_media_info_.receivers.push_back(video_receiver_info);
hbos1f8239c2017-01-16 12:24:10172 }
173 }
174
Henrik Boströmfc67b452022-07-27 08:55:45175 // Copies the current state of `voice_media_info_` and `video_media_info_`
176 // into the map.
177 void InitializeMap() {
178 map_.Initialize(voice_media_info_, video_media_info_, rtp_senders_,
179 rtp_receivers_);
hbos1f8239c2017-01-16 12:24:10180 }
181
Henrik Boströmfc67b452022-07-27 08:55:45182 private:
Niels Möller83830f32022-05-20 07:12:57183 rtc::AutoThread main_thread_;
Henrik Boströmfc67b452022-07-27 08:55:45184 cricket::VoiceMediaInfo voice_media_info_;
185 cricket::VideoMediaInfo video_media_info_;
186
187 protected:
Steve Anton57858b32018-02-15 23:19:50188 std::vector<rtc::scoped_refptr<RtpSenderInternal>> rtp_senders_;
189 std::vector<rtc::scoped_refptr<RtpReceiverInternal>> rtp_receivers_;
Henrik Boströmfc67b452022-07-27 08:55:45190 TrackMediaInfoMap map_;
hbos1f8239c2017-01-16 12:24:10191 rtc::scoped_refptr<AudioTrack> local_audio_track_;
192 rtc::scoped_refptr<AudioTrack> remote_audio_track_;
Tommi816134a2021-05-24 14:54:41193 rtc::scoped_refptr<VideoTrackInterface> local_video_track_;
194 rtc::scoped_refptr<VideoTrackInterface> remote_video_track_;
hbos1f8239c2017-01-16 12:24:10195};
196
197} // namespace
198
199TEST_F(TrackMediaInfoMapTest, SingleSenderReceiverPerTrackWithOneSsrc) {
Niels Möllerafb246b2022-04-20 12:26:50200 AddRtpSenderWithSsrcs({1}, local_audio_track_.get());
201 AddRtpReceiverWithSsrcs({2}, remote_audio_track_.get());
202 AddRtpSenderWithSsrcs({3}, local_video_track_.get());
203 AddRtpReceiverWithSsrcs({4}, remote_video_track_.get());
Henrik Boströmfc67b452022-07-27 08:55:45204 InitializeMap();
Henrik Boström4e231ee2023-05-24 09:24:13205 // RTP audio sender -> local audio track
Henrik Boströmfc67b452022-07-27 08:55:45206 EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[0]),
hbos1f8239c2017-01-16 12:24:10207 local_audio_track_.get());
Henrik Boström4e231ee2023-05-24 09:24:13208 // RTP audio receiver -> remote audio track
Henrik Boströmfc67b452022-07-27 08:55:45209 EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->receivers[0]),
hbos1f8239c2017-01-16 12:24:10210 remote_audio_track_.get());
Henrik Boström4e231ee2023-05-24 09:24:13211 // RTP video sender -> local video track
Henrik Boströmfc67b452022-07-27 08:55:45212 EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[0]),
hbos1f8239c2017-01-16 12:24:10213 local_video_track_.get());
Henrik Boström4e231ee2023-05-24 09:24:13214 // RTP video receiver -> remote video track
Henrik Boströmfc67b452022-07-27 08:55:45215 EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->receivers[0]),
hbos1f8239c2017-01-16 12:24:10216 remote_video_track_.get());
217}
218
hbos1f8239c2017-01-16 12:24:10219TEST_F(TrackMediaInfoMapTest,
220 SingleSenderReceiverPerTrackWithAudioAndVideoUseSameSsrc) {
Niels Möllerafb246b2022-04-20 12:26:50221 AddRtpSenderWithSsrcs({1}, local_audio_track_.get());
222 AddRtpReceiverWithSsrcs({2}, remote_audio_track_.get());
223 AddRtpSenderWithSsrcs({1}, local_video_track_.get());
224 AddRtpReceiverWithSsrcs({2}, remote_video_track_.get());
Henrik Boströmfc67b452022-07-27 08:55:45225 InitializeMap();
Henrik Boström4e231ee2023-05-24 09:24:13226 // RTP audio sender -> local audio track
Henrik Boströmfc67b452022-07-27 08:55:45227 EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[0]),
hbos1f8239c2017-01-16 12:24:10228 local_audio_track_.get());
Henrik Boström4e231ee2023-05-24 09:24:13229 // RTP audio receiver -> remote audio track
Henrik Boströmfc67b452022-07-27 08:55:45230 EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->receivers[0]),
hbos1f8239c2017-01-16 12:24:10231 remote_audio_track_.get());
Henrik Boström4e231ee2023-05-24 09:24:13232 // RTP video sender -> local video track
Henrik Boströmfc67b452022-07-27 08:55:45233 EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[0]),
hbos1f8239c2017-01-16 12:24:10234 local_video_track_.get());
Henrik Boström4e231ee2023-05-24 09:24:13235 // RTP video receiver -> remote video track
Henrik Boströmfc67b452022-07-27 08:55:45236 EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->receivers[0]),
hbos1f8239c2017-01-16 12:24:10237 remote_video_track_.get());
238}
239
240TEST_F(TrackMediaInfoMapTest, SingleMultiSsrcSenderPerTrack) {
Niels Möllerafb246b2022-04-20 12:26:50241 AddRtpSenderWithSsrcs({1, 2}, local_audio_track_.get());
242 AddRtpSenderWithSsrcs({3, 4}, local_video_track_.get());
Henrik Boströmfc67b452022-07-27 08:55:45243 InitializeMap();
Henrik Boström4e231ee2023-05-24 09:24:13244 // RTP audio senders -> local audio track
Henrik Boströmfc67b452022-07-27 08:55:45245 EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[0]),
hbos1f8239c2017-01-16 12:24:10246 local_audio_track_.get());
Henrik Boström4e231ee2023-05-24 09:24:13247 // RTP video senders -> local video track
Henrik Boströmfc67b452022-07-27 08:55:45248 EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[0]),
hbos1f8239c2017-01-16 12:24:10249 local_video_track_.get());
250}
251
252TEST_F(TrackMediaInfoMapTest, MultipleOneSsrcSendersPerTrack) {
Niels Möllerafb246b2022-04-20 12:26:50253 AddRtpSenderWithSsrcs({1}, local_audio_track_.get());
254 AddRtpSenderWithSsrcs({2}, local_audio_track_.get());
255 AddRtpSenderWithSsrcs({3}, local_video_track_.get());
256 AddRtpSenderWithSsrcs({4}, local_video_track_.get());
Henrik Boströmfc67b452022-07-27 08:55:45257 InitializeMap();
Henrik Boström4e231ee2023-05-24 09:24:13258 // RTP audio senders -> local audio track
Henrik Boströmfc67b452022-07-27 08:55:45259 EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[0]),
hbos1f8239c2017-01-16 12:24:10260 local_audio_track_.get());
Henrik Boströmfc67b452022-07-27 08:55:45261 EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[1]),
hbos1f8239c2017-01-16 12:24:10262 local_audio_track_.get());
Henrik Boström4e231ee2023-05-24 09:24:13263 // RTP video senders -> local video track
Henrik Boströmfc67b452022-07-27 08:55:45264 EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[0]),
hbos1f8239c2017-01-16 12:24:10265 local_video_track_.get());
Henrik Boströmfc67b452022-07-27 08:55:45266 EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[1]),
hbos1f8239c2017-01-16 12:24:10267 local_video_track_.get());
268}
269
270TEST_F(TrackMediaInfoMapTest, MultipleMultiSsrcSendersPerTrack) {
Niels Möllerafb246b2022-04-20 12:26:50271 AddRtpSenderWithSsrcs({1, 2}, local_audio_track_.get());
272 AddRtpSenderWithSsrcs({3, 4}, local_audio_track_.get());
273 AddRtpSenderWithSsrcs({5, 6}, local_video_track_.get());
274 AddRtpSenderWithSsrcs({7, 8}, local_video_track_.get());
Henrik Boströmfc67b452022-07-27 08:55:45275 InitializeMap();
Henrik Boström4e231ee2023-05-24 09:24:13276 // RTP audio senders -> local audio track
Henrik Boströmfc67b452022-07-27 08:55:45277 EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[0]),
hbos1f8239c2017-01-16 12:24:10278 local_audio_track_.get());
Henrik Boströmfc67b452022-07-27 08:55:45279 EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[1]),
hbos1f8239c2017-01-16 12:24:10280 local_audio_track_.get());
Henrik Boström4e231ee2023-05-24 09:24:13281 // RTP video senders -> local video track
Henrik Boströmfc67b452022-07-27 08:55:45282 EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[0]),
hbos1f8239c2017-01-16 12:24:10283 local_video_track_.get());
Henrik Boströmfc67b452022-07-27 08:55:45284 EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[1]),
hbos1f8239c2017-01-16 12:24:10285 local_video_track_.get());
286}
287
hbosfe90ad12017-02-20 10:05:13288// SSRCs can be reused for send and receive in loopback.
289TEST_F(TrackMediaInfoMapTest, SingleSenderReceiverPerTrackWithSsrcNotUnique) {
Niels Möllerafb246b2022-04-20 12:26:50290 AddRtpSenderWithSsrcs({1}, local_audio_track_.get());
291 AddRtpReceiverWithSsrcs({1}, remote_audio_track_.get());
292 AddRtpSenderWithSsrcs({2}, local_video_track_.get());
293 AddRtpReceiverWithSsrcs({2}, remote_video_track_.get());
Henrik Boströmfc67b452022-07-27 08:55:45294 InitializeMap();
Henrik Boström4e231ee2023-05-24 09:24:13295 // RTP audio senders -> local audio track
Henrik Boströmfc67b452022-07-27 08:55:45296 EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[0]),
hbosfe90ad12017-02-20 10:05:13297 local_audio_track_.get());
Henrik Boström4e231ee2023-05-24 09:24:13298 // RTP audio receiver -> remote audio track
Henrik Boströmfc67b452022-07-27 08:55:45299 EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->receivers[0]),
hbosfe90ad12017-02-20 10:05:13300 remote_audio_track_.get());
Henrik Boström4e231ee2023-05-24 09:24:13301 // RTP video senders -> local video track
Henrik Boströmfc67b452022-07-27 08:55:45302 EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[0]),
hbosfe90ad12017-02-20 10:05:13303 local_video_track_.get());
Henrik Boström4e231ee2023-05-24 09:24:13304 // RTP video receiver -> remote video track
Henrik Boströmfc67b452022-07-27 08:55:45305 EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->receivers[0]),
hbosfe90ad12017-02-20 10:05:13306 remote_video_track_.get());
307}
308
Harald Alvestrand89061872018-01-02 13:08:34309TEST_F(TrackMediaInfoMapTest, SsrcLookupFunction) {
Niels Möllerafb246b2022-04-20 12:26:50310 AddRtpSenderWithSsrcs({1}, local_audio_track_.get());
311 AddRtpReceiverWithSsrcs({2}, remote_audio_track_.get());
312 AddRtpSenderWithSsrcs({3}, local_video_track_.get());
313 AddRtpReceiverWithSsrcs({4}, remote_video_track_.get());
Henrik Boströmfc67b452022-07-27 08:55:45314 InitializeMap();
315 EXPECT_TRUE(map_.GetVoiceSenderInfoBySsrc(1));
316 EXPECT_TRUE(map_.GetVoiceReceiverInfoBySsrc(2));
317 EXPECT_TRUE(map_.GetVideoSenderInfoBySsrc(3));
318 EXPECT_TRUE(map_.GetVideoReceiverInfoBySsrc(4));
319 EXPECT_FALSE(map_.GetVoiceSenderInfoBySsrc(2));
320 EXPECT_FALSE(map_.GetVoiceSenderInfoBySsrc(1024));
Harald Alvestrand89061872018-01-02 13:08:34321}
322
Harald Alvestrandc72af932018-01-11 16:18:19323TEST_F(TrackMediaInfoMapTest, GetAttachmentIdByTrack) {
Niels Möllerafb246b2022-04-20 12:26:50324 AddRtpSenderWithSsrcs({1}, local_audio_track_.get());
Henrik Boströmfc67b452022-07-27 08:55:45325 InitializeMap();
Harald Alvestrandc72af932018-01-11 16:18:19326 EXPECT_EQ(rtp_senders_[0]->AttachmentId(),
Henrik Boströmfc67b452022-07-27 08:55:45327 map_.GetAttachmentIdByTrack(local_audio_track_.get()));
Niels Möllerafb246b2022-04-20 12:26:50328 EXPECT_EQ(absl::nullopt,
Henrik Boströmfc67b452022-07-27 08:55:45329 map_.GetAttachmentIdByTrack(local_video_track_.get()));
Harald Alvestrandc72af932018-01-11 16:18:19330}
331
hbos1f8239c2017-01-16 12:24:10332} // namespace webrtc