Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: webrtc/media/engine/fakewebrtccall.cc

Issue 2511703002: Wire up FlexFEC in VideoEngine2. (Closed)
Patch Set: Rebase on top of magjed's CL + corresponding fixes. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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() {
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
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::vector<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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 static_cast<FakeVideoReceiveStream*>(receive_stream)); 470 static_cast<FakeVideoReceiveStream*>(receive_stream));
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) {
magjed_webrtc 2016/11/18 14:28:00 I would like this to be a const-ref as well (and/o
brandtr 2016/11/21 08:52:03 Can't do it here alone, because FakeCall is a webr
454 // TODO(brandtr): Implement when adding integration with WebRtcVideoEngine2. 481 flexfec_receive_streams_.push_back(
455 return nullptr; 482 new FakeFlexfecReceiveStream(std::move(config)));
483 ++num_created_receive_streams_;
484 return flexfec_receive_streams_.back();
456 } 485 }
457 486
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 auto it = std::find(flexfec_receive_streams_.begin(),
490 flexfec_receive_streams_.end(),
491 static_cast<FakeFlexfecReceiveStream*>(receive_stream));
492 if (it == flexfec_receive_streams_.end()) {
493 ADD_FAILURE()
494 << "DestroyFlexfecReceiveStream called with unknown parameter.";
495 } else {
496 delete *it;
497 flexfec_receive_streams_.erase(it);
498 }
461 } 499 }
462 500
463 webrtc::PacketReceiver* FakeCall::Receiver() { 501 webrtc::PacketReceiver* FakeCall::Receiver() {
464 return this; 502 return this;
465 } 503 }
466 504
467 FakeCall::DeliveryStatus FakeCall::DeliverPacket( 505 FakeCall::DeliveryStatus FakeCall::DeliverPacket(
468 webrtc::MediaType media_type, 506 webrtc::MediaType media_type,
469 const uint8_t* packet, 507 const uint8_t* packet,
470 size_t length, 508 size_t length,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } 585 }
548 586
549 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { 587 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) {
550 last_sent_packet_ = sent_packet; 588 last_sent_packet_ = sent_packet;
551 if (sent_packet.packet_id >= 0) { 589 if (sent_packet.packet_id >= 0) {
552 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; 590 last_sent_nonnegative_packet_id_ = sent_packet.packet_id;
553 } 591 }
554 } 592 }
555 593
556 } // namespace cricket 594 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698