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_ = |
155 SetVideoPlayout(kVideoSsrc, true, | 155 new VideoRtpReceiver(stream_, kVideoTrackId, rtc::Thread::Current(), |
156 video_track_->GetSink())); | 156 kVideoSsrc, &video_provider_); |
157 video_rtp_receiver_ = new VideoRtpReceiver(stream_->GetVideoTracks()[0], | 157 video_track_ = video_rtp_receiver_->video_track(); |
158 kVideoSsrc, &video_provider_); | |
159 } | 158 } |
160 | 159 |
161 void DestroyAudioRtpReceiver() { | 160 void DestroyAudioRtpReceiver() { |
162 EXPECT_CALL(audio_provider_, SetAudioPlayout(kAudioSsrc, false)); | 161 EXPECT_CALL(audio_provider_, SetAudioPlayout(kAudioSsrc, false)); |
163 audio_rtp_receiver_ = nullptr; | 162 audio_rtp_receiver_ = nullptr; |
164 } | 163 } |
165 | 164 |
166 void DestroyVideoRtpReceiver() { | 165 void DestroyVideoRtpReceiver() { |
167 EXPECT_CALL(video_provider_, SetVideoPlayout(kVideoSsrc, false, NULL)); | 166 EXPECT_CALL(video_provider_, SetVideoPlayout(kVideoSsrc, false, NULL)); |
168 video_rtp_receiver_ = nullptr; | 167 video_rtp_receiver_ = nullptr; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 236 |
238 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)); | 237 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)); |
239 video_track_->set_enabled(false); | 238 video_track_->set_enabled(false); |
240 | 239 |
241 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); | 240 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, true, _)); |
242 video_track_->set_enabled(true); | 241 video_track_->set_enabled(true); |
243 | 242 |
244 DestroyVideoRtpSender(); | 243 DestroyVideoRtpSender(); |
245 } | 244 } |
246 | 245 |
| 246 TEST_F(RtpSenderReceiverTest, RemoteVideoTrackState) { |
| 247 CreateVideoRtpReceiver(); |
| 248 |
| 249 EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, video_track_->state()); |
| 250 EXPECT_EQ(webrtc::MediaSourceInterface::kLive, |
| 251 video_track_->GetSource()->state()); |
| 252 |
| 253 DestroyVideoRtpReceiver(); |
| 254 |
| 255 EXPECT_EQ(webrtc::MediaStreamTrackInterface::kEnded, video_track_->state()); |
| 256 EXPECT_EQ(webrtc::MediaSourceInterface::kEnded, |
| 257 video_track_->GetSource()->state()); |
| 258 } |
| 259 |
247 TEST_F(RtpSenderReceiverTest, RemoteVideoTrackDisable) { | 260 TEST_F(RtpSenderReceiverTest, RemoteVideoTrackDisable) { |
248 CreateVideoRtpReceiver(); | 261 CreateVideoRtpReceiver(); |
249 | 262 |
250 video_track_->set_enabled(false); | 263 video_track_->set_enabled(false); |
251 | 264 |
252 video_track_->set_enabled(true); | 265 video_track_->set_enabled(true); |
253 | 266 |
254 DestroyVideoRtpReceiver(); | 267 DestroyVideoRtpReceiver(); |
255 } | 268 } |
256 | 269 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 video_track_->GetSource()->GetVideoCapturer())); | 491 video_track_->GetSource()->GetVideoCapturer())); |
479 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, true, _)); | 492 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, true, _)); |
480 sender->SetSsrc(kVideoSsrc2); | 493 sender->SetSsrc(kVideoSsrc2); |
481 | 494 |
482 // Calls expected from destructor. | 495 // Calls expected from destructor. |
483 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc2, nullptr)).Times(1); | 496 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc2, nullptr)).Times(1); |
484 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, false, _)).Times(1); | 497 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, false, _)).Times(1); |
485 } | 498 } |
486 | 499 |
487 } // namespace webrtc | 500 } // namespace webrtc |
OLD | NEW |