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

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

Issue 2685573003: Be less pessimistic about turning "default" receive streams into signaled streams. (Closed)
Patch Set: rebase Created 3 years, 10 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/webrtcvoiceengine.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
11 #include "webrtc/media/engine/fakewebrtccall.h" 11 #include "webrtc/media/engine/fakewebrtccall.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <utility> 14 #include <utility>
15 15
16 #include "webrtc/api/call/audio_sink.h" 16 #include "webrtc/api/call/audio_sink.h"
17 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
18 #include "webrtc/base/platform_file.h" 18 #include "webrtc/base/platform_file.h"
19 #include "webrtc/base/gunit.h" 19 #include "webrtc/base/gunit.h"
20 #include "webrtc/media/base/rtputils.h" 20 #include "webrtc/media/base/rtputils.h"
21 21
22 namespace cricket { 22 namespace cricket {
23 FakeAudioSendStream::FakeAudioSendStream( 23 FakeAudioSendStream::FakeAudioSendStream(
24 const webrtc::AudioSendStream::Config& config) : config_(config) { 24 int id, const webrtc::AudioSendStream::Config& config)
25 : id_(id), config_(config) {
25 RTC_DCHECK(config.voe_channel_id != -1); 26 RTC_DCHECK(config.voe_channel_id != -1);
26 } 27 }
27 28
28 const webrtc::AudioSendStream::Config& 29 const webrtc::AudioSendStream::Config&
29 FakeAudioSendStream::GetConfig() const { 30 FakeAudioSendStream::GetConfig() const {
30 return config_; 31 return config_;
31 } 32 }
32 33
33 void FakeAudioSendStream::SetStats( 34 void FakeAudioSendStream::SetStats(
34 const webrtc::AudioSendStream::Stats& stats) { 35 const webrtc::AudioSendStream::Stats& stats) {
(...skipping 17 matching lines...) Expand all
52 53
53 void FakeAudioSendStream::SetMuted(bool muted) { 54 void FakeAudioSendStream::SetMuted(bool muted) {
54 muted_ = muted; 55 muted_ = muted;
55 } 56 }
56 57
57 webrtc::AudioSendStream::Stats FakeAudioSendStream::GetStats() const { 58 webrtc::AudioSendStream::Stats FakeAudioSendStream::GetStats() const {
58 return stats_; 59 return stats_;
59 } 60 }
60 61
61 FakeAudioReceiveStream::FakeAudioReceiveStream( 62 FakeAudioReceiveStream::FakeAudioReceiveStream(
62 const webrtc::AudioReceiveStream::Config& config) 63 int id, const webrtc::AudioReceiveStream::Config& config)
63 : config_(config) { 64 : id_(id), config_(config) {
64 RTC_DCHECK(config.voe_channel_id != -1); 65 RTC_DCHECK(config.voe_channel_id != -1);
65 } 66 }
66 67
67 const webrtc::AudioReceiveStream::Config& 68 const webrtc::AudioReceiveStream::Config&
68 FakeAudioReceiveStream::GetConfig() const { 69 FakeAudioReceiveStream::GetConfig() const {
69 return config_; 70 return config_;
70 } 71 }
71 72
72 void FakeAudioReceiveStream::SetStats( 73 void FakeAudioReceiveStream::SetStats(
73 const webrtc::AudioReceiveStream::Stats& stats) { 74 const webrtc::AudioReceiveStream::Stats& stats) {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 398 }
398 // Even though all the values for the enum class are listed above,the compiler 399 // Even though all the values for the enum class are listed above,the compiler
399 // will emit a warning as the method may be called with a value outside of the 400 // will emit a warning as the method may be called with a value outside of the
400 // valid enum range, unless this case is also handled. 401 // valid enum range, unless this case is also handled.
401 ADD_FAILURE() << "GetNetworkState called with unknown parameter."; 402 ADD_FAILURE() << "GetNetworkState called with unknown parameter.";
402 return webrtc::kNetworkDown; 403 return webrtc::kNetworkDown;
403 } 404 }
404 405
405 webrtc::AudioSendStream* FakeCall::CreateAudioSendStream( 406 webrtc::AudioSendStream* FakeCall::CreateAudioSendStream(
406 const webrtc::AudioSendStream::Config& config) { 407 const webrtc::AudioSendStream::Config& config) {
407 FakeAudioSendStream* fake_stream = new FakeAudioSendStream(config); 408 FakeAudioSendStream* fake_stream = new FakeAudioSendStream(next_stream_id_++,
409 config);
408 audio_send_streams_.push_back(fake_stream); 410 audio_send_streams_.push_back(fake_stream);
409 ++num_created_send_streams_; 411 ++num_created_send_streams_;
410 return fake_stream; 412 return fake_stream;
411 } 413 }
412 414
413 void FakeCall::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) { 415 void FakeCall::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) {
414 auto it = std::find(audio_send_streams_.begin(), 416 auto it = std::find(audio_send_streams_.begin(),
415 audio_send_streams_.end(), 417 audio_send_streams_.end(),
416 static_cast<FakeAudioSendStream*>(send_stream)); 418 static_cast<FakeAudioSendStream*>(send_stream));
417 if (it == audio_send_streams_.end()) { 419 if (it == audio_send_streams_.end()) {
418 ADD_FAILURE() << "DestroyAudioSendStream called with unknown parameter."; 420 ADD_FAILURE() << "DestroyAudioSendStream called with unknown parameter.";
419 } else { 421 } else {
420 delete *it; 422 delete *it;
421 audio_send_streams_.erase(it); 423 audio_send_streams_.erase(it);
422 } 424 }
423 } 425 }
424 426
425 webrtc::AudioReceiveStream* FakeCall::CreateAudioReceiveStream( 427 webrtc::AudioReceiveStream* FakeCall::CreateAudioReceiveStream(
426 const webrtc::AudioReceiveStream::Config& config) { 428 const webrtc::AudioReceiveStream::Config& config) {
427 audio_receive_streams_.push_back(new FakeAudioReceiveStream(config)); 429 audio_receive_streams_.push_back(new FakeAudioReceiveStream(next_stream_id_++,
430 config));
428 ++num_created_receive_streams_; 431 ++num_created_receive_streams_;
429 return audio_receive_streams_.back(); 432 return audio_receive_streams_.back();
430 } 433 }
431 434
432 void FakeCall::DestroyAudioReceiveStream( 435 void FakeCall::DestroyAudioReceiveStream(
433 webrtc::AudioReceiveStream* receive_stream) { 436 webrtc::AudioReceiveStream* receive_stream) {
434 auto it = std::find(audio_receive_streams_.begin(), 437 auto it = std::find(audio_receive_streams_.begin(),
435 audio_receive_streams_.end(), 438 audio_receive_streams_.end(),
436 static_cast<FakeAudioReceiveStream*>(receive_stream)); 439 static_cast<FakeAudioReceiveStream*>(receive_stream));
437 if (it == audio_receive_streams_.end()) { 440 if (it == audio_receive_streams_.end()) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 } 597 }
595 598
596 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { 599 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) {
597 last_sent_packet_ = sent_packet; 600 last_sent_packet_ = sent_packet;
598 if (sent_packet.packet_id >= 0) { 601 if (sent_packet.packet_id >= 0) {
599 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; 602 last_sent_nonnegative_packet_id_ = sent_packet.packet_id;
600 } 603 }
601 } 604 }
602 605
603 } // namespace cricket 606 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/fakewebrtccall.h ('k') | webrtc/media/engine/webrtcvoiceengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698