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

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

Issue 2645703003: Stop leaking FlexfecReceiveStream objects after call shutdown. (Closed)
Patch Set: Rebase. Created 3 years, 11 months 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
« no previous file with comments | « webrtc/media/engine/fakewebrtccall.h ('k') | webrtc/media/engine/webrtcvideoengine2.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 371
372 const FakeAudioReceiveStream* FakeCall::GetAudioReceiveStream(uint32_t ssrc) { 372 const FakeAudioReceiveStream* FakeCall::GetAudioReceiveStream(uint32_t ssrc) {
373 for (const auto* p : GetAudioReceiveStreams()) { 373 for (const auto* p : GetAudioReceiveStreams()) {
374 if (p->GetConfig().rtp.remote_ssrc == ssrc) { 374 if (p->GetConfig().rtp.remote_ssrc == ssrc) {
375 return p; 375 return p;
376 } 376 }
377 } 377 }
378 return nullptr; 378 return nullptr;
379 } 379 }
380 380
381 const std::list<FakeFlexfecReceiveStream>& 381 const std::vector<FakeFlexfecReceiveStream*>&
382 FakeCall::GetFlexfecReceiveStreams() { 382 FakeCall::GetFlexfecReceiveStreams() {
383 return flexfec_receive_streams_; 383 return flexfec_receive_streams_;
384 } 384 }
385 385
386 webrtc::NetworkState FakeCall::GetNetworkState(webrtc::MediaType media) const { 386 webrtc::NetworkState FakeCall::GetNetworkState(webrtc::MediaType media) const {
387 switch (media) { 387 switch (media) {
388 case webrtc::MediaType::AUDIO: 388 case webrtc::MediaType::AUDIO:
389 return audio_network_state_; 389 return audio_network_state_;
390 case webrtc::MediaType::VIDEO: 390 case webrtc::MediaType::VIDEO:
391 return video_network_state_; 391 return video_network_state_;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 if (it == video_receive_streams_.end()) { 479 if (it == video_receive_streams_.end()) {
480 ADD_FAILURE() << "DestroyVideoReceiveStream called with unknown parameter."; 480 ADD_FAILURE() << "DestroyVideoReceiveStream called with unknown parameter.";
481 } else { 481 } else {
482 delete *it; 482 delete *it;
483 video_receive_streams_.erase(it); 483 video_receive_streams_.erase(it);
484 } 484 }
485 } 485 }
486 486
487 webrtc::FlexfecReceiveStream* FakeCall::CreateFlexfecReceiveStream( 487 webrtc::FlexfecReceiveStream* FakeCall::CreateFlexfecReceiveStream(
488 const webrtc::FlexfecReceiveStream::Config& config) { 488 const webrtc::FlexfecReceiveStream::Config& config) {
489 flexfec_receive_streams_.push_back(FakeFlexfecReceiveStream(config)); 489 FakeFlexfecReceiveStream* fake_stream = new FakeFlexfecReceiveStream(config);
490 flexfec_receive_streams_.push_back(fake_stream);
490 ++num_created_receive_streams_; 491 ++num_created_receive_streams_;
491 return &flexfec_receive_streams_.back(); 492 return fake_stream;
492 } 493 }
493 494
494 void FakeCall::DestroyFlexfecReceiveStream( 495 void FakeCall::DestroyFlexfecReceiveStream(
495 webrtc::FlexfecReceiveStream* receive_stream) { 496 webrtc::FlexfecReceiveStream* receive_stream) {
496 for (auto it = flexfec_receive_streams_.begin(); 497 auto it = std::find(flexfec_receive_streams_.begin(),
497 it != flexfec_receive_streams_.end(); ++it) { 498 flexfec_receive_streams_.end(),
498 if (&(*it) == receive_stream) { 499 static_cast<FakeFlexfecReceiveStream*>(receive_stream));
499 flexfec_receive_streams_.erase(it); 500 if (it == flexfec_receive_streams_.end()) {
500 return; 501 ADD_FAILURE()
501 } 502 << "DestroyFlexfecReceiveStream called with unknown parameter.";
503 } else {
504 delete *it;
505 flexfec_receive_streams_.erase(it);
502 } 506 }
503 ADD_FAILURE() << "DestroyFlexfecReceiveStream called with unknown parameter.";
504 } 507 }
505 508
506 webrtc::PacketReceiver* FakeCall::Receiver() { 509 webrtc::PacketReceiver* FakeCall::Receiver() {
507 return this; 510 return this;
508 } 511 }
509 512
510 FakeCall::DeliveryStatus FakeCall::DeliverPacket( 513 FakeCall::DeliveryStatus FakeCall::DeliverPacket(
511 webrtc::MediaType media_type, 514 webrtc::MediaType media_type,
512 const uint8_t* packet, 515 const uint8_t* packet,
513 size_t length, 516 size_t length,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 } 593 }
591 594
592 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { 595 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) {
593 last_sent_packet_ = sent_packet; 596 last_sent_packet_ = sent_packet;
594 if (sent_packet.packet_id >= 0) { 597 if (sent_packet.packet_id >= 0) {
595 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; 598 last_sent_nonnegative_packet_id_ = sent_packet.packet_id;
596 } 599 }
597 } 600 }
598 601
599 } // namespace cricket 602 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/fakewebrtccall.h ('k') | webrtc/media/engine/webrtcvideoengine2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698