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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 void FakeVideoReceiveStream::SetStats( | 287 void FakeVideoReceiveStream::SetStats( |
288 const webrtc::VideoReceiveStream::Stats& stats) { | 288 const webrtc::VideoReceiveStream::Stats& stats) { |
289 stats_ = stats; | 289 stats_ = stats; |
290 } | 290 } |
291 | 291 |
292 void FakeVideoReceiveStream::EnableEncodedFrameRecording(rtc::PlatformFile file, | 292 void FakeVideoReceiveStream::EnableEncodedFrameRecording(rtc::PlatformFile file, |
293 size_t byte_limit) { | 293 size_t byte_limit) { |
294 rtc::ClosePlatformFile(file); | 294 rtc::ClosePlatformFile(file); |
295 } | 295 } |
296 | 296 |
297 FakeFlexfecReceiveStream::FakeFlexfecReceiveStream( | |
298 webrtc::FlexfecReceiveStream::Config config) | |
magjed_webrtc
2016/11/17 13:37:19
I think this should be:
FakeFlexfecReceiveStream(c
brandtr
2016/11/17 17:28:57
Yes, this was sloppy. Changed to const ref ctor!
| |
299 : config_(std::move(config)), receiving_(false) {} | |
300 | |
301 const webrtc::FlexfecReceiveStream::Config& | |
302 FakeFlexfecReceiveStream::GetConfig() { | |
303 return config_; | |
304 } | |
305 | |
306 void FakeFlexfecReceiveStream::Start() { | |
307 receiving_ = true; | |
308 } | |
309 | |
310 void FakeFlexfecReceiveStream::Stop() { | |
311 receiving_ = false; | |
312 } | |
313 | |
314 // TODO(brandtr): Implement when the stats have been designed. | |
315 webrtc::FlexfecReceiveStream::Stats FakeFlexfecReceiveStream::GetStats() const { | |
316 return webrtc::FlexfecReceiveStream::Stats(); | |
317 } | |
318 | |
297 FakeCall::FakeCall(const webrtc::Call::Config& config) | 319 FakeCall::FakeCall(const webrtc::Call::Config& config) |
298 : config_(config), | 320 : config_(config), |
299 audio_network_state_(webrtc::kNetworkUp), | 321 audio_network_state_(webrtc::kNetworkUp), |
300 video_network_state_(webrtc::kNetworkUp), | 322 video_network_state_(webrtc::kNetworkUp), |
301 num_created_send_streams_(0), | 323 num_created_send_streams_(0), |
302 num_created_receive_streams_(0) {} | 324 num_created_receive_streams_(0) {} |
303 | 325 |
304 FakeCall::~FakeCall() { | 326 FakeCall::~FakeCall() { |
305 EXPECT_EQ(0u, video_send_streams_.size()); | 327 EXPECT_EQ(0u, video_send_streams_.size()); |
306 EXPECT_EQ(0u, audio_send_streams_.size()); | 328 EXPECT_EQ(0u, audio_send_streams_.size()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 | 361 |
340 const FakeAudioReceiveStream* FakeCall::GetAudioReceiveStream(uint32_t ssrc) { | 362 const FakeAudioReceiveStream* FakeCall::GetAudioReceiveStream(uint32_t ssrc) { |
341 for (const auto* p : GetAudioReceiveStreams()) { | 363 for (const auto* p : GetAudioReceiveStreams()) { |
342 if (p->GetConfig().rtp.remote_ssrc == ssrc) { | 364 if (p->GetConfig().rtp.remote_ssrc == ssrc) { |
343 return p; | 365 return p; |
344 } | 366 } |
345 } | 367 } |
346 return nullptr; | 368 return nullptr; |
347 } | 369 } |
348 | 370 |
371 const std::vector<FakeFlexfecReceiveStream*>& | |
372 FakeCall::GetFlexfecReceiveStreams() { | |
373 return flexfec_receive_streams_; | |
374 } | |
375 | |
349 webrtc::NetworkState FakeCall::GetNetworkState(webrtc::MediaType media) const { | 376 webrtc::NetworkState FakeCall::GetNetworkState(webrtc::MediaType media) const { |
350 switch (media) { | 377 switch (media) { |
351 case webrtc::MediaType::AUDIO: | 378 case webrtc::MediaType::AUDIO: |
352 return audio_network_state_; | 379 return audio_network_state_; |
353 case webrtc::MediaType::VIDEO: | 380 case webrtc::MediaType::VIDEO: |
354 return video_network_state_; | 381 return video_network_state_; |
355 case webrtc::MediaType::DATA: | 382 case webrtc::MediaType::DATA: |
356 case webrtc::MediaType::ANY: | 383 case webrtc::MediaType::ANY: |
357 ADD_FAILURE() << "GetNetworkState called with unknown parameter."; | 384 ADD_FAILURE() << "GetNetworkState called with unknown parameter."; |
358 return webrtc::kNetworkDown; | 385 return webrtc::kNetworkDown; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
442 if (it == video_receive_streams_.end()) { | 469 if (it == video_receive_streams_.end()) { |
443 ADD_FAILURE() << "DestroyVideoReceiveStream called with unknown parameter."; | 470 ADD_FAILURE() << "DestroyVideoReceiveStream called with unknown parameter."; |
444 } else { | 471 } else { |
445 delete *it; | 472 delete *it; |
446 video_receive_streams_.erase(it); | 473 video_receive_streams_.erase(it); |
447 } | 474 } |
448 } | 475 } |
449 | 476 |
450 webrtc::FlexfecReceiveStream* FakeCall::CreateFlexfecReceiveStream( | 477 webrtc::FlexfecReceiveStream* FakeCall::CreateFlexfecReceiveStream( |
451 webrtc::FlexfecReceiveStream::Config config) { | 478 webrtc::FlexfecReceiveStream::Config config) { |
452 // TODO(brandtr): Implement when adding integration with WebRtcVideoEngine2. | 479 flexfec_receive_streams_.push_back( |
453 return nullptr; | 480 new FakeFlexfecReceiveStream(std::move(config))); |
481 ++num_created_receive_streams_; | |
stefan-webrtc
2016/11/17 12:48:59
num_created_flexfec_receive_streams_....
brandtr
2016/11/17 13:23:36
Don't think so, this variable is shared between vi
| |
482 return flexfec_receive_streams_.back(); | |
454 } | 483 } |
455 | 484 |
456 void FakeCall::DestroyFlexfecReceiveStream( | 485 void FakeCall::DestroyFlexfecReceiveStream( |
457 webrtc::FlexfecReceiveStream* receive_stream) { | 486 webrtc::FlexfecReceiveStream* receive_stream) { |
458 // TODO(brandtr): Implement when adding integration with WebRtcVideoEngine2. | 487 auto it = std::find(flexfec_receive_streams_.begin(), |
488 flexfec_receive_streams_.end(), | |
489 static_cast<FakeFlexfecReceiveStream*>(receive_stream)); | |
490 if (it == flexfec_receive_streams_.end()) { | |
491 ADD_FAILURE() | |
492 << "DestroyFlexfecReceiveStream called with unknown parameter."; | |
493 } else { | |
494 delete *it; | |
495 flexfec_receive_streams_.erase(it); | |
496 } | |
459 } | 497 } |
460 | 498 |
461 webrtc::PacketReceiver* FakeCall::Receiver() { | 499 webrtc::PacketReceiver* FakeCall::Receiver() { |
462 return this; | 500 return this; |
463 } | 501 } |
464 | 502 |
465 FakeCall::DeliveryStatus FakeCall::DeliverPacket( | 503 FakeCall::DeliveryStatus FakeCall::DeliverPacket( |
466 webrtc::MediaType media_type, | 504 webrtc::MediaType media_type, |
467 const uint8_t* packet, | 505 const uint8_t* packet, |
468 size_t length, | 506 size_t length, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
545 } | 583 } |
546 | 584 |
547 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { | 585 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { |
548 last_sent_packet_ = sent_packet; | 586 last_sent_packet_ = sent_packet; |
549 if (sent_packet.packet_id >= 0) { | 587 if (sent_packet.packet_id >= 0) { |
550 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; | 588 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; |
551 } | 589 } |
552 } | 590 } |
553 | 591 |
554 } // namespace cricket | 592 } // namespace cricket |
OLD | NEW |