• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
11 #include "pc/track_media_info_map.h"
12 
13 #include <stddef.h>
14 
15 #include <cstdint>
16 #include <initializer_list>
17 #include <string>
18 #include <type_traits>
19 #include <utility>
20 #include <vector>
21 
22 #include "api/media_types.h"
23 #include "api/rtp_parameters.h"
24 #include "api/test/mock_video_track.h"
25 #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"
31 #include "rtc_base/checks.h"
32 #include "rtc_base/thread.h"
33 #include "test/gmock.h"
34 #include "test/gtest.h"
35 
36 using ::testing::ElementsAre;
37 
38 namespace webrtc {
39 
40 namespace {
41 
CreateRtpParametersWithSsrcs(std::initializer_list<uint32_t> ssrcs)42 RtpParameters CreateRtpParametersWithSsrcs(
43     std::initializer_list<uint32_t> ssrcs) {
44   RtpParameters params;
45   for (uint32_t ssrc : ssrcs) {
46     RtpEncodingParameters encoding_params;
47     encoding_params.ssrc = ssrc;
48     params.encodings.push_back(encoding_params);
49   }
50   return params;
51 }
52 
CreateMockRtpSender(cricket::MediaType media_type,std::initializer_list<uint32_t> ssrcs,rtc::scoped_refptr<MediaStreamTrackInterface> track)53 rtc::scoped_refptr<MockRtpSenderInternal> CreateMockRtpSender(
54     cricket::MediaType media_type,
55     std::initializer_list<uint32_t> ssrcs,
56     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   }
63   auto sender = rtc::make_ref_counted<MockRtpSenderInternal>();
64   EXPECT_CALL(*sender, track())
65       .WillRepeatedly(::testing::Return(std::move(track)));
66   EXPECT_CALL(*sender, ssrc()).WillRepeatedly(::testing::Return(first_ssrc));
67   EXPECT_CALL(*sender, media_type())
68       .WillRepeatedly(::testing::Return(media_type));
69   EXPECT_CALL(*sender, GetParameters())
70       .WillRepeatedly(::testing::Return(CreateRtpParametersWithSsrcs(ssrcs)));
71   EXPECT_CALL(*sender, AttachmentId()).WillRepeatedly(::testing::Return(1));
72   return sender;
73 }
74 
CreateMockRtpReceiver(cricket::MediaType media_type,std::initializer_list<uint32_t> ssrcs,rtc::scoped_refptr<MediaStreamTrackInterface> track)75 rtc::scoped_refptr<MockRtpReceiverInternal> CreateMockRtpReceiver(
76     cricket::MediaType media_type,
77     std::initializer_list<uint32_t> ssrcs,
78     rtc::scoped_refptr<MediaStreamTrackInterface> track) {
79   auto receiver = rtc::make_ref_counted<MockRtpReceiverInternal>();
80   EXPECT_CALL(*receiver, track())
81       .WillRepeatedly(::testing::Return(std::move(track)));
82   EXPECT_CALL(*receiver, media_type())
83       .WillRepeatedly(::testing::Return(media_type));
84   EXPECT_CALL(*receiver, GetParameters())
85       .WillRepeatedly(::testing::Return(CreateRtpParametersWithSsrcs(ssrcs)));
86   EXPECT_CALL(*receiver, AttachmentId()).WillRepeatedly(::testing::Return(1));
87   return receiver;
88 }
89 
CreateVideoTrack(const std::string & id)90 rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack(
91     const std::string& id) {
92   return VideoTrack::Create(id, FakeVideoTrackSource::Create(false),
93                             rtc::Thread::Current());
94 }
95 
CreateMockVideoTrack(const std::string & id)96 rtc::scoped_refptr<VideoTrackInterface> CreateMockVideoTrack(
97     const std::string& id) {
98   auto track = MockVideoTrack::Create();
99   EXPECT_CALL(*track, kind())
100       .WillRepeatedly(::testing::Return(VideoTrack::kVideoKind));
101   return track;
102 }
103 
104 class TrackMediaInfoMapTest : public ::testing::Test {
105  public:
TrackMediaInfoMapTest()106   TrackMediaInfoMapTest() : TrackMediaInfoMapTest(true) {}
107 
TrackMediaInfoMapTest(bool use_real_video_track)108   explicit TrackMediaInfoMapTest(bool use_real_video_track)
109       : local_audio_track_(AudioTrack::Create("LocalAudioTrack", nullptr)),
110         remote_audio_track_(AudioTrack::Create("RemoteAudioTrack", nullptr)),
111         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")) {}
117 
AddRtpSenderWithSsrcs(std::initializer_list<uint32_t> ssrcs,MediaStreamTrackInterface * local_track)118   void AddRtpSenderWithSsrcs(std::initializer_list<uint32_t> ssrcs,
119                              MediaStreamTrackInterface* local_track) {
120     rtc::scoped_refptr<MockRtpSenderInternal> rtp_sender = CreateMockRtpSender(
121         local_track->kind() == MediaStreamTrackInterface::kAudioKind
122             ? cricket::MEDIA_TYPE_AUDIO
123             : cricket::MEDIA_TYPE_VIDEO,
124         ssrcs, rtc::scoped_refptr<MediaStreamTrackInterface>(local_track));
125     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       }
134       voice_media_info_.senders.push_back(voice_sender_info);
135     } 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       }
142       video_media_info_.senders.push_back(video_sender_info);
143       video_media_info_.aggregated_senders.push_back(video_sender_info);
144     }
145   }
146 
AddRtpReceiverWithSsrcs(std::initializer_list<uint32_t> ssrcs,MediaStreamTrackInterface * remote_track)147   void AddRtpReceiverWithSsrcs(std::initializer_list<uint32_t> ssrcs,
148                                MediaStreamTrackInterface* remote_track) {
149     auto rtp_receiver = CreateMockRtpReceiver(
150         remote_track->kind() == MediaStreamTrackInterface::kAudioKind
151             ? cricket::MEDIA_TYPE_AUDIO
152             : cricket::MEDIA_TYPE_VIDEO,
153         ssrcs, rtc::scoped_refptr<MediaStreamTrackInterface>(remote_track));
154     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       }
163       voice_media_info_.receivers.push_back(voice_receiver_info);
164     } 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       }
171       video_media_info_.receivers.push_back(video_receiver_info);
172     }
173   }
174 
175   // Copies the current state of `voice_media_info_` and `video_media_info_`
176   // into the map.
InitializeMap()177   void InitializeMap() {
178     map_.Initialize(voice_media_info_, video_media_info_, rtp_senders_,
179                     rtp_receivers_);
180   }
181 
182  private:
183   rtc::AutoThread main_thread_;
184   cricket::VoiceMediaInfo voice_media_info_;
185   cricket::VideoMediaInfo video_media_info_;
186 
187  protected:
188   std::vector<rtc::scoped_refptr<RtpSenderInternal>> rtp_senders_;
189   std::vector<rtc::scoped_refptr<RtpReceiverInternal>> rtp_receivers_;
190   TrackMediaInfoMap map_;
191   rtc::scoped_refptr<AudioTrack> local_audio_track_;
192   rtc::scoped_refptr<AudioTrack> remote_audio_track_;
193   rtc::scoped_refptr<VideoTrackInterface> local_video_track_;
194   rtc::scoped_refptr<VideoTrackInterface> remote_video_track_;
195 };
196 
197 }  // namespace
198 
TEST_F(TrackMediaInfoMapTest,SingleSenderReceiverPerTrackWithOneSsrc)199 TEST_F(TrackMediaInfoMapTest, SingleSenderReceiverPerTrackWithOneSsrc) {
200   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());
204   InitializeMap();
205 
206   // Local audio track <-> RTP audio sender
207   ASSERT_TRUE(map_.GetVoiceSenderInfos(*local_audio_track_));
208   EXPECT_THAT(*map_.GetVoiceSenderInfos(*local_audio_track_),
209               ElementsAre(&map_.voice_media_info()->senders[0]));
210   EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[0]),
211             local_audio_track_.get());
212 
213   // Remote audio track <-> RTP audio receiver
214   EXPECT_EQ(map_.GetVoiceReceiverInfo(*remote_audio_track_),
215             &map_.voice_media_info()->receivers[0]);
216   EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->receivers[0]),
217             remote_audio_track_.get());
218 
219   // Local video track <-> RTP video sender
220   ASSERT_TRUE(map_.GetVideoSenderInfos(*local_video_track_));
221   EXPECT_THAT(*map_.GetVideoSenderInfos(*local_video_track_),
222               ElementsAre(&map_.video_media_info()->senders[0]));
223   EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[0]),
224             local_video_track_.get());
225 
226   // Remote video track <-> RTP video receiver
227   EXPECT_EQ(map_.GetVideoReceiverInfo(*remote_video_track_),
228             &map_.video_media_info()->receivers[0]);
229   EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->receivers[0]),
230             remote_video_track_.get());
231 }
232 
TEST_F(TrackMediaInfoMapTest,SingleSenderReceiverPerTrackWithMissingSsrc)233 TEST_F(TrackMediaInfoMapTest, SingleSenderReceiverPerTrackWithMissingSsrc) {
234   AddRtpSenderWithSsrcs({}, local_audio_track_.get());
235   AddRtpSenderWithSsrcs({}, local_video_track_.get());
236   AddRtpReceiverWithSsrcs({}, remote_audio_track_.get());
237   AddRtpReceiverWithSsrcs({}, remote_video_track_.get());
238   InitializeMap();
239 
240   EXPECT_FALSE(map_.GetVoiceSenderInfos(*local_audio_track_));
241   EXPECT_FALSE(map_.GetVideoSenderInfos(*local_video_track_));
242   EXPECT_FALSE(map_.GetVoiceReceiverInfo(*remote_audio_track_));
243   EXPECT_FALSE(map_.GetVideoReceiverInfo(*remote_video_track_));
244 }
245 
TEST_F(TrackMediaInfoMapTest,SingleSenderReceiverPerTrackWithAudioAndVideoUseSameSsrc)246 TEST_F(TrackMediaInfoMapTest,
247        SingleSenderReceiverPerTrackWithAudioAndVideoUseSameSsrc) {
248   AddRtpSenderWithSsrcs({1}, local_audio_track_.get());
249   AddRtpReceiverWithSsrcs({2}, remote_audio_track_.get());
250   AddRtpSenderWithSsrcs({1}, local_video_track_.get());
251   AddRtpReceiverWithSsrcs({2}, remote_video_track_.get());
252   InitializeMap();
253 
254   // Local audio track <-> RTP audio sender
255   ASSERT_TRUE(map_.GetVoiceSenderInfos(*local_audio_track_));
256   EXPECT_THAT(*map_.GetVoiceSenderInfos(*local_audio_track_),
257               ElementsAre(&map_.voice_media_info()->senders[0]));
258   EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[0]),
259             local_audio_track_.get());
260 
261   // Remote audio track <-> RTP audio receiver
262   EXPECT_EQ(map_.GetVoiceReceiverInfo(*remote_audio_track_),
263             &map_.voice_media_info()->receivers[0]);
264   EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->receivers[0]),
265             remote_audio_track_.get());
266 
267   // Local video track <-> RTP video sender
268   ASSERT_TRUE(map_.GetVideoSenderInfos(*local_video_track_));
269   EXPECT_THAT(*map_.GetVideoSenderInfos(*local_video_track_),
270               ElementsAre(&map_.video_media_info()->senders[0]));
271   EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[0]),
272             local_video_track_.get());
273 
274   // Remote video track <-> RTP video receiver
275   EXPECT_EQ(map_.GetVideoReceiverInfo(*remote_video_track_),
276             &map_.video_media_info()->receivers[0]);
277   EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->receivers[0]),
278             remote_video_track_.get());
279 }
280 
TEST_F(TrackMediaInfoMapTest,SingleMultiSsrcSenderPerTrack)281 TEST_F(TrackMediaInfoMapTest, SingleMultiSsrcSenderPerTrack) {
282   AddRtpSenderWithSsrcs({1, 2}, local_audio_track_.get());
283   AddRtpSenderWithSsrcs({3, 4}, local_video_track_.get());
284   InitializeMap();
285 
286   // Local audio track <-> RTP audio senders
287   ASSERT_TRUE(map_.GetVoiceSenderInfos(*local_audio_track_));
288   EXPECT_THAT(*map_.GetVoiceSenderInfos(*local_audio_track_),
289               ElementsAre(&map_.voice_media_info()->senders[0]));
290   EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[0]),
291             local_audio_track_.get());
292 
293   // Local video track <-> RTP video senders
294   ASSERT_TRUE(map_.GetVideoSenderInfos(*local_video_track_));
295   EXPECT_THAT(*map_.GetVideoSenderInfos(*local_video_track_),
296               ElementsAre(&map_.video_media_info()->senders[0]));
297   EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[0]),
298             local_video_track_.get());
299 }
300 
TEST_F(TrackMediaInfoMapTest,MultipleOneSsrcSendersPerTrack)301 TEST_F(TrackMediaInfoMapTest, MultipleOneSsrcSendersPerTrack) {
302   AddRtpSenderWithSsrcs({1}, local_audio_track_.get());
303   AddRtpSenderWithSsrcs({2}, local_audio_track_.get());
304   AddRtpSenderWithSsrcs({3}, local_video_track_.get());
305   AddRtpSenderWithSsrcs({4}, local_video_track_.get());
306   InitializeMap();
307 
308   // Local audio track <-> RTP audio senders
309   ASSERT_TRUE(map_.GetVoiceSenderInfos(*local_audio_track_));
310   EXPECT_THAT(*map_.GetVoiceSenderInfos(*local_audio_track_),
311               ElementsAre(&map_.voice_media_info()->senders[0],
312                           &map_.voice_media_info()->senders[1]));
313   EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[0]),
314             local_audio_track_.get());
315   EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[1]),
316             local_audio_track_.get());
317 
318   // Local video track <-> RTP video senders
319   ASSERT_TRUE(map_.GetVideoSenderInfos(*local_video_track_));
320   EXPECT_THAT(*map_.GetVideoSenderInfos(*local_video_track_),
321               ElementsAre(&map_.video_media_info()->senders[0],
322                           &map_.video_media_info()->senders[1]));
323   EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[0]),
324             local_video_track_.get());
325   EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[1]),
326             local_video_track_.get());
327 }
328 
TEST_F(TrackMediaInfoMapTest,MultipleMultiSsrcSendersPerTrack)329 TEST_F(TrackMediaInfoMapTest, MultipleMultiSsrcSendersPerTrack) {
330   AddRtpSenderWithSsrcs({1, 2}, local_audio_track_.get());
331   AddRtpSenderWithSsrcs({3, 4}, local_audio_track_.get());
332   AddRtpSenderWithSsrcs({5, 6}, local_video_track_.get());
333   AddRtpSenderWithSsrcs({7, 8}, local_video_track_.get());
334   InitializeMap();
335 
336   // Local audio track <-> RTP audio senders
337   ASSERT_TRUE(map_.GetVoiceSenderInfos(*local_audio_track_));
338   EXPECT_THAT(*map_.GetVoiceSenderInfos(*local_audio_track_),
339               ElementsAre(&map_.voice_media_info()->senders[0],
340                           &map_.voice_media_info()->senders[1]));
341   EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[0]),
342             local_audio_track_.get());
343   EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[1]),
344             local_audio_track_.get());
345 
346   // Local video track <-> RTP video senders
347   ASSERT_TRUE(map_.GetVideoSenderInfos(*local_video_track_));
348   EXPECT_THAT(*map_.GetVideoSenderInfos(*local_video_track_),
349               ElementsAre(&map_.video_media_info()->senders[0],
350                           &map_.video_media_info()->senders[1]));
351   EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[0]),
352             local_video_track_.get());
353   EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[1]),
354             local_video_track_.get());
355 }
356 
357 // SSRCs can be reused for send and receive in loopback.
TEST_F(TrackMediaInfoMapTest,SingleSenderReceiverPerTrackWithSsrcNotUnique)358 TEST_F(TrackMediaInfoMapTest, SingleSenderReceiverPerTrackWithSsrcNotUnique) {
359   AddRtpSenderWithSsrcs({1}, local_audio_track_.get());
360   AddRtpReceiverWithSsrcs({1}, remote_audio_track_.get());
361   AddRtpSenderWithSsrcs({2}, local_video_track_.get());
362   AddRtpReceiverWithSsrcs({2}, remote_video_track_.get());
363   InitializeMap();
364 
365   // Local audio track <-> RTP audio senders
366   ASSERT_TRUE(map_.GetVoiceSenderInfos(*local_audio_track_));
367   EXPECT_THAT(*map_.GetVoiceSenderInfos(*local_audio_track_),
368               ElementsAre(&map_.voice_media_info()->senders[0]));
369   EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->senders[0]),
370             local_audio_track_.get());
371 
372   // Remote audio track <-> RTP audio receiver
373   EXPECT_EQ(map_.GetVoiceReceiverInfo(*remote_audio_track_),
374             &map_.voice_media_info()->receivers[0]);
375   EXPECT_EQ(map_.GetAudioTrack(map_.voice_media_info()->receivers[0]),
376             remote_audio_track_.get());
377 
378   // Local video track <-> RTP video senders
379   ASSERT_TRUE(map_.GetVideoSenderInfos(*local_video_track_));
380   EXPECT_THAT(*map_.GetVideoSenderInfos(*local_video_track_),
381               ElementsAre(&map_.video_media_info()->senders[0]));
382   EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->senders[0]),
383             local_video_track_.get());
384 
385   // Remote video track <-> RTP video receiver
386   EXPECT_EQ(map_.GetVideoReceiverInfo(*remote_video_track_),
387             &map_.video_media_info()->receivers[0]);
388   EXPECT_EQ(map_.GetVideoTrack(map_.video_media_info()->receivers[0]),
389             remote_video_track_.get());
390 }
391 
TEST_F(TrackMediaInfoMapTest,SsrcLookupFunction)392 TEST_F(TrackMediaInfoMapTest, SsrcLookupFunction) {
393   AddRtpSenderWithSsrcs({1}, local_audio_track_.get());
394   AddRtpReceiverWithSsrcs({2}, remote_audio_track_.get());
395   AddRtpSenderWithSsrcs({3}, local_video_track_.get());
396   AddRtpReceiverWithSsrcs({4}, remote_video_track_.get());
397   InitializeMap();
398   EXPECT_TRUE(map_.GetVoiceSenderInfoBySsrc(1));
399   EXPECT_TRUE(map_.GetVoiceReceiverInfoBySsrc(2));
400   EXPECT_TRUE(map_.GetVideoSenderInfoBySsrc(3));
401   EXPECT_TRUE(map_.GetVideoReceiverInfoBySsrc(4));
402   EXPECT_FALSE(map_.GetVoiceSenderInfoBySsrc(2));
403   EXPECT_FALSE(map_.GetVoiceSenderInfoBySsrc(1024));
404 }
405 
TEST_F(TrackMediaInfoMapTest,GetAttachmentIdByTrack)406 TEST_F(TrackMediaInfoMapTest, GetAttachmentIdByTrack) {
407   AddRtpSenderWithSsrcs({1}, local_audio_track_.get());
408   InitializeMap();
409   EXPECT_EQ(rtp_senders_[0]->AttachmentId(),
410             map_.GetAttachmentIdByTrack(local_audio_track_.get()));
411   EXPECT_EQ(absl::nullopt,
412             map_.GetAttachmentIdByTrack(local_video_track_.get()));
413 }
414 
415 // Death tests.
416 // Disabled on Android because death tests misbehave on Android, see
417 // base/test/gtest_util.h.
418 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
419 
420 class TrackMediaInfoMapDeathTest : public TrackMediaInfoMapTest {
421  public:
TrackMediaInfoMapDeathTest()422   TrackMediaInfoMapDeathTest() : TrackMediaInfoMapTest(false) {}
423 };
424 
TEST_F(TrackMediaInfoMapDeathTest,MultipleOneSsrcReceiversPerTrack)425 TEST_F(TrackMediaInfoMapDeathTest, MultipleOneSsrcReceiversPerTrack) {
426   AddRtpReceiverWithSsrcs({1}, remote_audio_track_.get());
427   AddRtpReceiverWithSsrcs({2}, remote_audio_track_.get());
428   AddRtpReceiverWithSsrcs({3}, remote_video_track_.get());
429   AddRtpReceiverWithSsrcs({4}, remote_video_track_.get());
430   EXPECT_DEATH(InitializeMap(), "");
431 }
432 
TEST_F(TrackMediaInfoMapDeathTest,MultipleMultiSsrcReceiversPerTrack)433 TEST_F(TrackMediaInfoMapDeathTest, MultipleMultiSsrcReceiversPerTrack) {
434   AddRtpReceiverWithSsrcs({1, 2}, remote_audio_track_.get());
435   AddRtpReceiverWithSsrcs({3, 4}, remote_audio_track_.get());
436   AddRtpReceiverWithSsrcs({5, 6}, remote_video_track_.get());
437   AddRtpReceiverWithSsrcs({7, 8}, remote_video_track_.get());
438   EXPECT_DEATH(InitializeMap(), "");
439 }
440 
441 #endif  // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
442 
443 }  // namespace webrtc
444