OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 void FakeVideoReceiveStream::SetStats( | 289 void FakeVideoReceiveStream::SetStats( |
290 const webrtc::VideoReceiveStream::Stats& stats) { | 290 const webrtc::VideoReceiveStream::Stats& stats) { |
291 stats_ = stats; | 291 stats_ = stats; |
292 } | 292 } |
293 | 293 |
294 void FakeVideoReceiveStream::EnableEncodedFrameRecording(rtc::PlatformFile file, | 294 void FakeVideoReceiveStream::EnableEncodedFrameRecording(rtc::PlatformFile file, |
295 size_t byte_limit) { | 295 size_t byte_limit) { |
296 rtc::ClosePlatformFile(file); | 296 rtc::ClosePlatformFile(file); |
297 } | 297 } |
298 | 298 |
299 FakeFlexfecReceiveStream::FakeFlexfecReceiveStream( | |
300 const webrtc::FlexfecReceiveStream::Config& config) | |
301 : config_(config), receiving_(false) {} | |
302 | |
303 const webrtc::FlexfecReceiveStream::Config& | |
304 FakeFlexfecReceiveStream::GetConfig() const { | |
305 return config_; | |
306 } | |
307 | |
308 void FakeFlexfecReceiveStream::Start() { | |
309 receiving_ = true; | |
310 } | |
311 | |
312 void FakeFlexfecReceiveStream::Stop() { | |
313 receiving_ = false; | |
314 } | |
315 | |
316 // TODO(brandtr): Implement when the stats have been designed. | |
317 webrtc::FlexfecReceiveStream::Stats FakeFlexfecReceiveStream::GetStats() const { | |
318 return webrtc::FlexfecReceiveStream::Stats(); | |
319 } | |
320 | |
299 FakeCall::FakeCall(const webrtc::Call::Config& config) | 321 FakeCall::FakeCall(const webrtc::Call::Config& config) |
300 : config_(config), | 322 : config_(config), |
301 audio_network_state_(webrtc::kNetworkUp), | 323 audio_network_state_(webrtc::kNetworkUp), |
302 video_network_state_(webrtc::kNetworkUp), | 324 video_network_state_(webrtc::kNetworkUp), |
303 num_created_send_streams_(0), | 325 num_created_send_streams_(0), |
304 num_created_receive_streams_(0) {} | 326 num_created_receive_streams_(0) {} |
305 | 327 |
306 FakeCall::~FakeCall() { | 328 FakeCall::~FakeCall() { |
307 EXPECT_EQ(0u, video_send_streams_.size()); | 329 EXPECT_EQ(0u, video_send_streams_.size()); |
308 EXPECT_EQ(0u, audio_send_streams_.size()); | 330 EXPECT_EQ(0u, audio_send_streams_.size()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 | 363 |
342 const FakeAudioReceiveStream* FakeCall::GetAudioReceiveStream(uint32_t ssrc) { | 364 const FakeAudioReceiveStream* FakeCall::GetAudioReceiveStream(uint32_t ssrc) { |
343 for (const auto* p : GetAudioReceiveStreams()) { | 365 for (const auto* p : GetAudioReceiveStreams()) { |
344 if (p->GetConfig().rtp.remote_ssrc == ssrc) { | 366 if (p->GetConfig().rtp.remote_ssrc == ssrc) { |
345 return p; | 367 return p; |
346 } | 368 } |
347 } | 369 } |
348 return nullptr; | 370 return nullptr; |
349 } | 371 } |
350 | 372 |
373 const std::list<FakeFlexfecReceiveStream>& | |
374 FakeCall::GetFlexfecReceiveStreams() { | |
375 return flexfec_receive_streams_; | |
376 } | |
377 | |
351 webrtc::NetworkState FakeCall::GetNetworkState(webrtc::MediaType media) const { | 378 webrtc::NetworkState FakeCall::GetNetworkState(webrtc::MediaType media) const { |
352 switch (media) { | 379 switch (media) { |
353 case webrtc::MediaType::AUDIO: | 380 case webrtc::MediaType::AUDIO: |
354 return audio_network_state_; | 381 return audio_network_state_; |
355 case webrtc::MediaType::VIDEO: | 382 case webrtc::MediaType::VIDEO: |
356 return video_network_state_; | 383 return video_network_state_; |
357 case webrtc::MediaType::DATA: | 384 case webrtc::MediaType::DATA: |
358 case webrtc::MediaType::ANY: | 385 case webrtc::MediaType::ANY: |
359 ADD_FAILURE() << "GetNetworkState called with unknown parameter."; | 386 ADD_FAILURE() << "GetNetworkState called with unknown parameter."; |
360 return webrtc::kNetworkDown; | 387 return webrtc::kNetworkDown; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
444 if (it == video_receive_streams_.end()) { | 471 if (it == video_receive_streams_.end()) { |
445 ADD_FAILURE() << "DestroyVideoReceiveStream called with unknown parameter."; | 472 ADD_FAILURE() << "DestroyVideoReceiveStream called with unknown parameter."; |
446 } else { | 473 } else { |
447 delete *it; | 474 delete *it; |
448 video_receive_streams_.erase(it); | 475 video_receive_streams_.erase(it); |
449 } | 476 } |
450 } | 477 } |
451 | 478 |
452 webrtc::FlexfecReceiveStream* FakeCall::CreateFlexfecReceiveStream( | 479 webrtc::FlexfecReceiveStream* FakeCall::CreateFlexfecReceiveStream( |
453 webrtc::FlexfecReceiveStream::Config config) { | 480 webrtc::FlexfecReceiveStream::Config config) { |
454 // TODO(brandtr): Implement when adding integration with WebRtcVideoEngine2. | 481 flexfec_receive_streams_.push_back( |
455 return nullptr; | 482 FakeFlexfecReceiveStream(std::move(config))); |
483 ++num_created_receive_streams_; | |
484 return &flexfec_receive_streams_.back(); | |
456 } | 485 } |
457 | 486 |
brandtr
2016/11/21 16:03:47
These changes are clearly not "very convoluted", s
| |
458 void FakeCall::DestroyFlexfecReceiveStream( | 487 void FakeCall::DestroyFlexfecReceiveStream( |
459 webrtc::FlexfecReceiveStream* receive_stream) { | 488 webrtc::FlexfecReceiveStream* receive_stream) { |
460 // TODO(brandtr): Implement when adding integration with WebRtcVideoEngine2. | 489 for (auto it = flexfec_receive_streams_.begin(); |
490 it != flexfec_receive_streams_.end(); ++it) { | |
491 if (&(*it) == receive_stream) { | |
492 flexfec_receive_streams_.erase(it); | |
493 return; | |
494 } | |
495 } | |
496 ADD_FAILURE() << "DestroyFlexfecReceiveStream called with unknown parameter."; | |
461 } | 497 } |
462 | 498 |
463 webrtc::PacketReceiver* FakeCall::Receiver() { | 499 webrtc::PacketReceiver* FakeCall::Receiver() { |
464 return this; | 500 return this; |
465 } | 501 } |
466 | 502 |
467 FakeCall::DeliveryStatus FakeCall::DeliverPacket( | 503 FakeCall::DeliveryStatus FakeCall::DeliverPacket( |
468 webrtc::MediaType media_type, | 504 webrtc::MediaType media_type, |
469 const uint8_t* packet, | 505 const uint8_t* packet, |
470 size_t length, | 506 size_t length, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
547 } | 583 } |
548 | 584 |
549 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { | 585 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { |
550 last_sent_packet_ = sent_packet; | 586 last_sent_packet_ = sent_packet; |
551 if (sent_packet.packet_id >= 0) { | 587 if (sent_packet.packet_id >= 0) { |
552 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; | 588 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; |
553 } | 589 } |
554 } | 590 } |
555 | 591 |
556 } // namespace cricket | 592 } // namespace cricket |
OLD | NEW |