OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 void CreateAudioRtpReceiver() { | 143 void CreateAudioRtpReceiver() { |
144 audio_track_ = AudioTrack::Create( | 144 audio_track_ = AudioTrack::Create( |
145 kAudioTrackId, RemoteAudioSource::Create(kAudioSsrc, NULL)); | 145 kAudioTrackId, RemoteAudioSource::Create(kAudioSsrc, NULL)); |
146 EXPECT_TRUE(stream_->AddTrack(audio_track_)); | 146 EXPECT_TRUE(stream_->AddTrack(audio_track_)); |
147 EXPECT_CALL(audio_provider_, SetAudioPlayout(kAudioSsrc, true)); | 147 EXPECT_CALL(audio_provider_, SetAudioPlayout(kAudioSsrc, true)); |
148 audio_rtp_receiver_ = new AudioRtpReceiver(stream_->GetAudioTracks()[0], | 148 audio_rtp_receiver_ = new AudioRtpReceiver(stream_->GetAudioTracks()[0], |
149 kAudioSsrc, &audio_provider_); | 149 kAudioSsrc, &audio_provider_); |
150 } | 150 } |
151 | 151 |
152 void CreateVideoRtpReceiver() { | 152 void CreateVideoRtpReceiver() { |
153 AddVideoTrack(true); | 153 EXPECT_CALL(video_provider_, SetVideoPlayout(kVideoSsrc, true, _)); |
154 EXPECT_CALL(video_provider_, | 154 video_rtp_receiver_ = new VideoRtpReceiver( |
155 SetVideoPlayout(kVideoSsrc, true, | 155 kVideoTrackId, rtc::Thread::Current(), kVideoSsrc, &video_provider_); |
156 video_track_->GetSink())); | 156 video_track_ = video_rtp_receiver_->video_track(); |
Taylor Brandstetter
2016/03/09 22:10:41
Just for consistency, this should probably add the
perkj_webrtc
2016/03/10 00:26:38
Done.
| |
157 video_rtp_receiver_ = new VideoRtpReceiver(stream_->GetVideoTracks()[0], | |
158 kVideoSsrc, &video_provider_); | |
159 } | 157 } |
160 | 158 |
161 void DestroyAudioRtpReceiver() { | 159 void DestroyAudioRtpReceiver() { |
162 EXPECT_CALL(audio_provider_, SetAudioPlayout(kAudioSsrc, false)); | 160 EXPECT_CALL(audio_provider_, SetAudioPlayout(kAudioSsrc, false)); |
163 audio_rtp_receiver_ = nullptr; | 161 audio_rtp_receiver_ = nullptr; |
164 } | 162 } |
165 | 163 |
166 void DestroyVideoRtpReceiver() { | 164 void DestroyVideoRtpReceiver() { |
167 EXPECT_CALL(video_provider_, SetVideoPlayout(kVideoSsrc, false, NULL)); | 165 EXPECT_CALL(video_provider_, SetVideoPlayout(kVideoSsrc, false, NULL)); |
168 video_rtp_receiver_ = nullptr; | 166 video_rtp_receiver_ = nullptr; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 | 235 |
238 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)); | 236 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)); |
239 video_track_->set_enabled(false); | 237 video_track_->set_enabled(false); |
240 | 238 |
241 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); | 239 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); |
242 video_track_->set_enabled(true); | 240 video_track_->set_enabled(true); |
243 | 241 |
244 DestroyVideoRtpSender(); | 242 DestroyVideoRtpSender(); |
245 } | 243 } |
246 | 244 |
245 TEST_F(RtpSenderReceiverTest, RemoteVideoTrackState) { | |
246 CreateVideoRtpReceiver(); | |
247 | |
248 EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, video_track_->state()); | |
249 EXPECT_EQ(webrtc::MediaSourceInterface::kLive, | |
250 video_track_->GetSource()->state()); | |
251 | |
252 DestroyVideoRtpReceiver(); | |
253 | |
254 EXPECT_EQ(webrtc::MediaStreamTrackInterface::kEnded, video_track_->state()); | |
255 EXPECT_EQ(webrtc::MediaSourceInterface::kEnded, | |
256 video_track_->GetSource()->state()); | |
257 } | |
258 | |
247 TEST_F(RtpSenderReceiverTest, RemoteVideoTrackDisable) { | 259 TEST_F(RtpSenderReceiverTest, RemoteVideoTrackDisable) { |
248 CreateVideoRtpReceiver(); | 260 CreateVideoRtpReceiver(); |
249 | 261 |
250 video_track_->set_enabled(false); | 262 video_track_->set_enabled(false); |
251 | 263 |
252 video_track_->set_enabled(true); | 264 video_track_->set_enabled(true); |
253 | 265 |
254 DestroyVideoRtpReceiver(); | 266 DestroyVideoRtpReceiver(); |
255 } | 267 } |
256 | 268 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
478 video_track_->GetSource()->GetVideoCapturer())); | 490 video_track_->GetSource()->GetVideoCapturer())); |
479 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, true, _)); | 491 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, true, _)); |
480 sender->SetSsrc(kVideoSsrc2); | 492 sender->SetSsrc(kVideoSsrc2); |
481 | 493 |
482 // Calls expected from destructor. | 494 // Calls expected from destructor. |
483 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc2, nullptr)).Times(1); | 495 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc2, nullptr)).Times(1); |
484 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, false, _)).Times(1); | 496 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, false, _)).Times(1); |
485 } | 497 } |
486 | 498 |
487 } // namespace webrtc | 499 } // namespace webrtc |
OLD | NEW |