OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 13 matching lines...) Expand all Loading... |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include <string> | 28 #include <string> |
29 #include <utility> | 29 #include <utility> |
30 | 30 |
31 #include "talk/app/webrtc/audiotrack.h" | 31 #include "talk/app/webrtc/audiotrack.h" |
32 #include "talk/app/webrtc/mediastream.h" | 32 #include "talk/app/webrtc/mediastream.h" |
33 #include "talk/app/webrtc/remoteaudiosource.h" | 33 #include "talk/app/webrtc/remoteaudiosource.h" |
34 #include "talk/app/webrtc/remoteaudiotrack.h" | |
35 #include "talk/app/webrtc/rtpreceiver.h" | 34 #include "talk/app/webrtc/rtpreceiver.h" |
36 #include "talk/app/webrtc/rtpsender.h" | 35 #include "talk/app/webrtc/rtpsender.h" |
37 #include "talk/app/webrtc/streamcollection.h" | 36 #include "talk/app/webrtc/streamcollection.h" |
38 #include "talk/app/webrtc/videosource.h" | 37 #include "talk/app/webrtc/videosource.h" |
39 #include "talk/app/webrtc/videotrack.h" | 38 #include "talk/app/webrtc/videotrack.h" |
40 #include "talk/media/base/fakevideocapturer.h" | 39 #include "talk/media/base/fakevideocapturer.h" |
41 #include "talk/media/base/mediachannel.h" | 40 #include "talk/media/base/mediachannel.h" |
42 #include "testing/gmock/include/gmock/gmock.h" | 41 #include "testing/gmock/include/gmock/gmock.h" |
43 #include "testing/gtest/include/gtest/gtest.h" | 42 #include "testing/gtest/include/gtest/gtest.h" |
44 #include "webrtc/base/gunit.h" | 43 #include "webrtc/base/gunit.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 bool enable, | 90 bool enable, |
92 cricket::VideoRenderer* renderer)); | 91 cricket::VideoRenderer* renderer)); |
93 MOCK_METHOD3(SetVideoSend, | 92 MOCK_METHOD3(SetVideoSend, |
94 void(uint32_t ssrc, | 93 void(uint32_t ssrc, |
95 bool enable, | 94 bool enable, |
96 const cricket::VideoOptions* options)); | 95 const cricket::VideoOptions* options)); |
97 }; | 96 }; |
98 | 97 |
99 class FakeVideoSource : public Notifier<VideoSourceInterface> { | 98 class FakeVideoSource : public Notifier<VideoSourceInterface> { |
100 public: | 99 public: |
101 static rtc::scoped_refptr<FakeVideoSource> Create() { | 100 static rtc::scoped_refptr<FakeVideoSource> Create(bool remote) { |
102 return new rtc::RefCountedObject<FakeVideoSource>(); | 101 return new rtc::RefCountedObject<FakeVideoSource>(remote); |
103 } | 102 } |
104 virtual cricket::VideoCapturer* GetVideoCapturer() { return &fake_capturer_; } | 103 virtual cricket::VideoCapturer* GetVideoCapturer() { return &fake_capturer_; } |
105 virtual void Stop() {} | 104 virtual void Stop() {} |
106 virtual void Restart() {} | 105 virtual void Restart() {} |
107 virtual void AddSink(cricket::VideoRenderer* output) {} | 106 virtual void AddSink(cricket::VideoRenderer* output) {} |
108 virtual void RemoveSink(cricket::VideoRenderer* output) {} | 107 virtual void RemoveSink(cricket::VideoRenderer* output) {} |
109 virtual SourceState state() const { return state_; } | 108 virtual SourceState state() const { return state_; } |
| 109 virtual bool remote() const { return remote_; } |
110 virtual const cricket::VideoOptions* options() const { return &options_; } | 110 virtual const cricket::VideoOptions* options() const { return &options_; } |
111 virtual cricket::VideoRenderer* FrameInput() { return NULL; } | 111 virtual cricket::VideoRenderer* FrameInput() { return NULL; } |
112 | 112 |
113 protected: | 113 protected: |
114 FakeVideoSource() : state_(kLive) {} | 114 explicit FakeVideoSource(bool remote) : state_(kLive), remote_(remote) {} |
115 ~FakeVideoSource() {} | 115 ~FakeVideoSource() {} |
116 | 116 |
117 private: | 117 private: |
118 cricket::FakeVideoCapturer fake_capturer_; | 118 cricket::FakeVideoCapturer fake_capturer_; |
119 SourceState state_; | 119 SourceState state_; |
| 120 bool remote_; |
120 cricket::VideoOptions options_; | 121 cricket::VideoOptions options_; |
121 }; | 122 }; |
122 | 123 |
123 class RtpSenderReceiverTest : public testing::Test { | 124 class RtpSenderReceiverTest : public testing::Test { |
124 public: | 125 public: |
125 virtual void SetUp() { | 126 virtual void SetUp() { |
126 stream_ = MediaStream::Create(kStreamLabel1); | 127 stream_ = MediaStream::Create(kStreamLabel1); |
127 rtc::scoped_refptr<VideoSourceInterface> source(FakeVideoSource::Create()); | 128 } |
| 129 |
| 130 void AddVideoTrack(bool remote) { |
| 131 rtc::scoped_refptr<VideoSourceInterface> source( |
| 132 FakeVideoSource::Create(remote)); |
128 video_track_ = VideoTrack::Create(kVideoTrackId, source); | 133 video_track_ = VideoTrack::Create(kVideoTrackId, source); |
129 EXPECT_TRUE(stream_->AddTrack(video_track_)); | 134 EXPECT_TRUE(stream_->AddTrack(video_track_)); |
130 } | 135 } |
131 | 136 |
132 void CreateAudioRtpSender() { | 137 void CreateAudioRtpSender() { |
133 audio_track_ = AudioTrack::Create(kAudioTrackId, NULL); | 138 audio_track_ = AudioTrack::Create(kAudioTrackId, NULL); |
134 EXPECT_TRUE(stream_->AddTrack(audio_track_)); | 139 EXPECT_TRUE(stream_->AddTrack(audio_track_)); |
135 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, true, _, _)); | 140 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, true, _, _)); |
136 audio_rtp_sender_ = | 141 audio_rtp_sender_ = |
137 new AudioRtpSender(stream_->GetAudioTracks()[0], stream_->label(), | 142 new AudioRtpSender(stream_->GetAudioTracks()[0], stream_->label(), |
138 &audio_provider_, nullptr); | 143 &audio_provider_, nullptr); |
139 audio_rtp_sender_->SetSsrc(kAudioSsrc); | 144 audio_rtp_sender_->SetSsrc(kAudioSsrc); |
140 } | 145 } |
141 | 146 |
142 void CreateVideoRtpSender() { | 147 void CreateVideoRtpSender() { |
| 148 AddVideoTrack(false); |
143 EXPECT_CALL(video_provider_, | 149 EXPECT_CALL(video_provider_, |
144 SetCaptureDevice( | 150 SetCaptureDevice( |
145 kVideoSsrc, video_track_->GetSource()->GetVideoCapturer())); | 151 kVideoSsrc, video_track_->GetSource()->GetVideoCapturer())); |
146 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); | 152 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); |
147 video_rtp_sender_ = new VideoRtpSender(stream_->GetVideoTracks()[0], | 153 video_rtp_sender_ = new VideoRtpSender(stream_->GetVideoTracks()[0], |
148 stream_->label(), &video_provider_); | 154 stream_->label(), &video_provider_); |
149 video_rtp_sender_->SetSsrc(kVideoSsrc); | 155 video_rtp_sender_->SetSsrc(kVideoSsrc); |
150 } | 156 } |
151 | 157 |
152 void DestroyAudioRtpSender() { | 158 void DestroyAudioRtpSender() { |
153 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, false, _, _)) | 159 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, false, _, _)) |
154 .Times(1); | 160 .Times(1); |
155 audio_rtp_sender_ = nullptr; | 161 audio_rtp_sender_ = nullptr; |
156 } | 162 } |
157 | 163 |
158 void DestroyVideoRtpSender() { | 164 void DestroyVideoRtpSender() { |
159 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc, NULL)).Times(1); | 165 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc, NULL)).Times(1); |
160 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)).Times(1); | 166 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)).Times(1); |
161 video_rtp_sender_ = nullptr; | 167 video_rtp_sender_ = nullptr; |
162 } | 168 } |
163 | 169 |
164 void CreateAudioRtpReceiver() { | 170 void CreateAudioRtpReceiver() { |
165 audio_track_ = RemoteAudioTrack::Create( | 171 audio_track_ = AudioTrack::Create( |
166 kAudioTrackId, RemoteAudioSource::Create(kAudioSsrc, NULL)); | 172 kAudioTrackId, RemoteAudioSource::Create(kAudioSsrc, NULL)); |
167 EXPECT_TRUE(stream_->AddTrack(audio_track_)); | 173 EXPECT_TRUE(stream_->AddTrack(audio_track_)); |
168 EXPECT_CALL(audio_provider_, SetAudioPlayout(kAudioSsrc, true)); | 174 EXPECT_CALL(audio_provider_, SetAudioPlayout(kAudioSsrc, true)); |
169 audio_rtp_receiver_ = new AudioRtpReceiver(stream_->GetAudioTracks()[0], | 175 audio_rtp_receiver_ = new AudioRtpReceiver(stream_->GetAudioTracks()[0], |
170 kAudioSsrc, &audio_provider_); | 176 kAudioSsrc, &audio_provider_); |
171 } | 177 } |
172 | 178 |
173 void CreateVideoRtpReceiver() { | 179 void CreateVideoRtpReceiver() { |
| 180 AddVideoTrack(true); |
174 EXPECT_CALL(video_provider_, | 181 EXPECT_CALL(video_provider_, |
175 SetVideoPlayout(kVideoSsrc, true, | 182 SetVideoPlayout(kVideoSsrc, true, |
176 video_track_->GetSource()->FrameInput())); | 183 video_track_->GetSource()->FrameInput())); |
177 video_rtp_receiver_ = new VideoRtpReceiver(stream_->GetVideoTracks()[0], | 184 video_rtp_receiver_ = new VideoRtpReceiver(stream_->GetVideoTracks()[0], |
178 kVideoSsrc, &video_provider_); | 185 kVideoSsrc, &video_provider_); |
179 } | 186 } |
180 | 187 |
181 void DestroyAudioRtpReceiver() { | 188 void DestroyAudioRtpReceiver() { |
182 EXPECT_CALL(audio_provider_, SetAudioPlayout(kAudioSsrc, false)); | 189 EXPECT_CALL(audio_provider_, SetAudioPlayout(kAudioSsrc, false)); |
183 audio_rtp_receiver_ = nullptr; | 190 audio_rtp_receiver_ = nullptr; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, true, _, _)); | 355 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, true, _, _)); |
349 sender->SetSsrc(kAudioSsrc); | 356 sender->SetSsrc(kAudioSsrc); |
350 | 357 |
351 // Calls expected from destructor. | 358 // Calls expected from destructor. |
352 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, false, _, _)).Times(1); | 359 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, false, _, _)).Times(1); |
353 } | 360 } |
354 | 361 |
355 // Test that a video sender calls the expected methods on the provider once | 362 // Test that a video sender calls the expected methods on the provider once |
356 // it has a track and SSRC, when the SSRC is set first. | 363 // it has a track and SSRC, when the SSRC is set first. |
357 TEST_F(RtpSenderReceiverTest, VideoSenderEarlyWarmupSsrcThenTrack) { | 364 TEST_F(RtpSenderReceiverTest, VideoSenderEarlyWarmupSsrcThenTrack) { |
| 365 AddVideoTrack(false); |
358 rtc::scoped_refptr<VideoRtpSender> sender = | 366 rtc::scoped_refptr<VideoRtpSender> sender = |
359 new VideoRtpSender(&video_provider_); | 367 new VideoRtpSender(&video_provider_); |
360 sender->SetSsrc(kVideoSsrc); | 368 sender->SetSsrc(kVideoSsrc); |
361 EXPECT_CALL(video_provider_, | 369 EXPECT_CALL(video_provider_, |
362 SetCaptureDevice(kVideoSsrc, | 370 SetCaptureDevice(kVideoSsrc, |
363 video_track_->GetSource()->GetVideoCapturer())); | 371 video_track_->GetSource()->GetVideoCapturer())); |
364 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); | 372 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); |
365 sender->SetTrack(video_track_); | 373 sender->SetTrack(video_track_); |
366 | 374 |
367 // Calls expected from destructor. | 375 // Calls expected from destructor. |
368 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc, nullptr)).Times(1); | 376 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc, nullptr)).Times(1); |
369 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)).Times(1); | 377 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)).Times(1); |
370 } | 378 } |
371 | 379 |
372 // Test that a video sender calls the expected methods on the provider once | 380 // Test that a video sender calls the expected methods on the provider once |
373 // it has a track and SSRC, when the SSRC is set last. | 381 // it has a track and SSRC, when the SSRC is set last. |
374 TEST_F(RtpSenderReceiverTest, VideoSenderEarlyWarmupTrackThenSsrc) { | 382 TEST_F(RtpSenderReceiverTest, VideoSenderEarlyWarmupTrackThenSsrc) { |
| 383 AddVideoTrack(false); |
375 rtc::scoped_refptr<VideoRtpSender> sender = | 384 rtc::scoped_refptr<VideoRtpSender> sender = |
376 new VideoRtpSender(&video_provider_); | 385 new VideoRtpSender(&video_provider_); |
377 sender->SetTrack(video_track_); | 386 sender->SetTrack(video_track_); |
378 EXPECT_CALL(video_provider_, | 387 EXPECT_CALL(video_provider_, |
379 SetCaptureDevice(kVideoSsrc, | 388 SetCaptureDevice(kVideoSsrc, |
380 video_track_->GetSource()->GetVideoCapturer())); | 389 video_track_->GetSource()->GetVideoCapturer())); |
381 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); | 390 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); |
382 sender->SetSsrc(kVideoSsrc); | 391 sender->SetSsrc(kVideoSsrc); |
383 | 392 |
384 // Calls expected from destructor. | 393 // Calls expected from destructor. |
(...skipping 15 matching lines...) Expand all Loading... |
400 sender->SetSsrc(0); | 409 sender->SetSsrc(0); |
401 | 410 |
402 // Make sure it's SetSsrc that called methods on the provider, and not the | 411 // Make sure it's SetSsrc that called methods on the provider, and not the |
403 // destructor. | 412 // destructor. |
404 EXPECT_CALL(audio_provider_, SetAudioSend(_, _, _, _)).Times(0); | 413 EXPECT_CALL(audio_provider_, SetAudioSend(_, _, _, _)).Times(0); |
405 } | 414 } |
406 | 415 |
407 // Test that the sender is disconnected from the provider when its SSRC is | 416 // Test that the sender is disconnected from the provider when its SSRC is |
408 // set to 0. | 417 // set to 0. |
409 TEST_F(RtpSenderReceiverTest, VideoSenderSsrcSetToZero) { | 418 TEST_F(RtpSenderReceiverTest, VideoSenderSsrcSetToZero) { |
| 419 AddVideoTrack(false); |
410 EXPECT_CALL(video_provider_, | 420 EXPECT_CALL(video_provider_, |
411 SetCaptureDevice(kVideoSsrc, | 421 SetCaptureDevice(kVideoSsrc, |
412 video_track_->GetSource()->GetVideoCapturer())); | 422 video_track_->GetSource()->GetVideoCapturer())); |
413 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); | 423 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); |
414 rtc::scoped_refptr<VideoRtpSender> sender = | 424 rtc::scoped_refptr<VideoRtpSender> sender = |
415 new VideoRtpSender(video_track_, kStreamLabel1, &video_provider_); | 425 new VideoRtpSender(video_track_, kStreamLabel1, &video_provider_); |
416 sender->SetSsrc(kVideoSsrc); | 426 sender->SetSsrc(kVideoSsrc); |
417 | 427 |
418 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc, nullptr)).Times(1); | 428 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc, nullptr)).Times(1); |
419 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)).Times(1); | 429 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)).Times(1); |
(...skipping 15 matching lines...) Expand all Loading... |
435 | 445 |
436 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, false, _, _)).Times(1); | 446 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, false, _, _)).Times(1); |
437 EXPECT_TRUE(sender->SetTrack(nullptr)); | 447 EXPECT_TRUE(sender->SetTrack(nullptr)); |
438 | 448 |
439 // Make sure it's SetTrack that called methods on the provider, and not the | 449 // Make sure it's SetTrack that called methods on the provider, and not the |
440 // destructor. | 450 // destructor. |
441 EXPECT_CALL(audio_provider_, SetAudioSend(_, _, _, _)).Times(0); | 451 EXPECT_CALL(audio_provider_, SetAudioSend(_, _, _, _)).Times(0); |
442 } | 452 } |
443 | 453 |
444 TEST_F(RtpSenderReceiverTest, VideoSenderTrackSetToNull) { | 454 TEST_F(RtpSenderReceiverTest, VideoSenderTrackSetToNull) { |
| 455 AddVideoTrack(false); |
445 EXPECT_CALL(video_provider_, | 456 EXPECT_CALL(video_provider_, |
446 SetCaptureDevice(kVideoSsrc, | 457 SetCaptureDevice(kVideoSsrc, |
447 video_track_->GetSource()->GetVideoCapturer())); | 458 video_track_->GetSource()->GetVideoCapturer())); |
448 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); | 459 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); |
449 rtc::scoped_refptr<VideoRtpSender> sender = | 460 rtc::scoped_refptr<VideoRtpSender> sender = |
450 new VideoRtpSender(video_track_, kStreamLabel1, &video_provider_); | 461 new VideoRtpSender(video_track_, kStreamLabel1, &video_provider_); |
451 sender->SetSsrc(kVideoSsrc); | 462 sender->SetSsrc(kVideoSsrc); |
452 | 463 |
453 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc, nullptr)).Times(1); | 464 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc, nullptr)).Times(1); |
454 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)).Times(1); | 465 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)).Times(1); |
455 EXPECT_TRUE(sender->SetTrack(nullptr)); | 466 EXPECT_TRUE(sender->SetTrack(nullptr)); |
456 | 467 |
457 // Make sure it's SetTrack that called methods on the provider, and not the | 468 // Make sure it's SetTrack that called methods on the provider, and not the |
458 // destructor. | 469 // destructor. |
459 EXPECT_CALL(video_provider_, SetCaptureDevice(_, _)).Times(0); | 470 EXPECT_CALL(video_provider_, SetCaptureDevice(_, _)).Times(0); |
460 EXPECT_CALL(video_provider_, SetVideoSend(_, _, _)).Times(0); | 471 EXPECT_CALL(video_provider_, SetVideoSend(_, _, _)).Times(0); |
461 } | 472 } |
462 | 473 |
463 TEST_F(RtpSenderReceiverTest, AudioSenderSsrcChanged) { | 474 TEST_F(RtpSenderReceiverTest, AudioSenderSsrcChanged) { |
| 475 AddVideoTrack(false); |
464 rtc::scoped_refptr<AudioTrackInterface> track = | 476 rtc::scoped_refptr<AudioTrackInterface> track = |
465 AudioTrack::Create(kAudioTrackId, nullptr); | 477 AudioTrack::Create(kAudioTrackId, nullptr); |
466 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, true, _, _)); | 478 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, true, _, _)); |
467 rtc::scoped_refptr<AudioRtpSender> sender = | 479 rtc::scoped_refptr<AudioRtpSender> sender = |
468 new AudioRtpSender(track, kStreamLabel1, &audio_provider_, nullptr); | 480 new AudioRtpSender(track, kStreamLabel1, &audio_provider_, nullptr); |
469 sender->SetSsrc(kAudioSsrc); | 481 sender->SetSsrc(kAudioSsrc); |
470 | 482 |
471 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, false, _, _)).Times(1); | 483 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc, false, _, _)).Times(1); |
472 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc2, true, _, _)).Times(1); | 484 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc2, true, _, _)).Times(1); |
473 sender->SetSsrc(kAudioSsrc2); | 485 sender->SetSsrc(kAudioSsrc2); |
474 | 486 |
475 // Calls expected from destructor. | 487 // Calls expected from destructor. |
476 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc2, false, _, _)).Times(1); | 488 EXPECT_CALL(audio_provider_, SetAudioSend(kAudioSsrc2, false, _, _)).Times(1); |
477 } | 489 } |
478 | 490 |
479 TEST_F(RtpSenderReceiverTest, VideoSenderSsrcChanged) { | 491 TEST_F(RtpSenderReceiverTest, VideoSenderSsrcChanged) { |
| 492 AddVideoTrack(false); |
480 EXPECT_CALL(video_provider_, | 493 EXPECT_CALL(video_provider_, |
481 SetCaptureDevice(kVideoSsrc, | 494 SetCaptureDevice(kVideoSsrc, |
482 video_track_->GetSource()->GetVideoCapturer())); | 495 video_track_->GetSource()->GetVideoCapturer())); |
483 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); | 496 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); |
484 rtc::scoped_refptr<VideoRtpSender> sender = | 497 rtc::scoped_refptr<VideoRtpSender> sender = |
485 new VideoRtpSender(video_track_, kStreamLabel1, &video_provider_); | 498 new VideoRtpSender(video_track_, kStreamLabel1, &video_provider_); |
486 sender->SetSsrc(kVideoSsrc); | 499 sender->SetSsrc(kVideoSsrc); |
487 | 500 |
488 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc, nullptr)).Times(1); | 501 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc, nullptr)).Times(1); |
489 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)).Times(1); | 502 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)).Times(1); |
490 EXPECT_CALL(video_provider_, | 503 EXPECT_CALL(video_provider_, |
491 SetCaptureDevice(kVideoSsrc2, | 504 SetCaptureDevice(kVideoSsrc2, |
492 video_track_->GetSource()->GetVideoCapturer())); | 505 video_track_->GetSource()->GetVideoCapturer())); |
493 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, true, _)); | 506 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, true, _)); |
494 sender->SetSsrc(kVideoSsrc2); | 507 sender->SetSsrc(kVideoSsrc2); |
495 | 508 |
496 // Calls expected from destructor. | 509 // Calls expected from destructor. |
497 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc2, nullptr)).Times(1); | 510 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc2, nullptr)).Times(1); |
498 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, false, _)).Times(1); | 511 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, false, _)).Times(1); |
499 } | 512 } |
500 | 513 |
501 } // namespace webrtc | 514 } // namespace webrtc |
OLD | NEW |