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

Side by Side Diff: talk/media/webrtc/fakewebrtcvoiceengine.h

Issue 1390753002: Implement AudioReceiveStream::GetStats(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: merge master Created 5 years, 2 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 | « talk/media/webrtc/fakewebrtccall.cc ('k') | talk/media/webrtc/webrtcvoe.h » ('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 * libjingle 2 * libjingle
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #else 58 #else
59 static const int kFakeDeviceId = 1; 59 static const int kFakeDeviceId = 1;
60 #endif 60 #endif
61 61
62 static const int kOpusBandwidthNb = 4000; 62 static const int kOpusBandwidthNb = 4000;
63 static const int kOpusBandwidthMb = 6000; 63 static const int kOpusBandwidthMb = 6000;
64 static const int kOpusBandwidthWb = 8000; 64 static const int kOpusBandwidthWb = 8000;
65 static const int kOpusBandwidthSwb = 12000; 65 static const int kOpusBandwidthSwb = 12000;
66 static const int kOpusBandwidthFb = 20000; 66 static const int kOpusBandwidthFb = 20000;
67 67
68 static const webrtc::NetworkStatistics kNetStats = {
69 1, // uint16_t currentBufferSize;
70 2, // uint16_t preferredBufferSize;
71 true, // bool jitterPeaksFound;
72 1234, // uint16_t currentPacketLossRate;
73 567, // uint16_t currentDiscardRate;
74 8901, // uint16_t currentExpandRate;
75 234, // uint16_t currentSpeechExpandRate;
76 5678, // uint16_t currentPreemptiveRate;
77 9012, // uint16_t currentAccelerateRate;
78 3456, // uint16_t currentSecondaryDecodedRate;
79 7890, // int32_t clockDriftPPM;
80 54, // meanWaitingTimeMs;
81 32, // int medianWaitingTimeMs;
82 1, // int minWaitingTimeMs;
83 98, // int maxWaitingTimeMs;
84 7654, // int addedSamples;
85 }; // These random but non-trivial numbers are used for testing.
86
87 #define WEBRTC_CHECK_CHANNEL(channel) \ 68 #define WEBRTC_CHECK_CHANNEL(channel) \
88 if (channels_.find(channel) == channels_.end()) return -1; 69 if (channels_.find(channel) == channels_.end()) return -1;
89 70
90 #define WEBRTC_ASSERT_CHANNEL(channel) \ 71 #define WEBRTC_ASSERT_CHANNEL(channel) \
91 RTC_DCHECK(channels_.find(channel) != channels_.end()); 72 RTC_DCHECK(channels_.find(channel) != channels_.end());
92 73
93 // Verify the header extension ID, if enabled, is within the bounds specified in 74 // Verify the header extension ID, if enabled, is within the bounds specified in
94 // [RFC5285]: 1-14 inclusive. 75 // [RFC5285]: 1-14 inclusive.
95 #define WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id) \ 76 #define WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id) \
96 do { \ 77 do { \
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return experimental_ns_enabled_; 155 return experimental_ns_enabled_;
175 } 156 }
176 157
177 private: 158 private:
178 bool experimental_ns_enabled_; 159 bool experimental_ns_enabled_;
179 }; 160 };
180 161
181 class FakeWebRtcVoiceEngine 162 class FakeWebRtcVoiceEngine
182 : public webrtc::VoEAudioProcessing, 163 : public webrtc::VoEAudioProcessing,
183 public webrtc::VoEBase, public webrtc::VoECodec, public webrtc::VoEDtmf, 164 public webrtc::VoEBase, public webrtc::VoECodec, public webrtc::VoEDtmf,
184 public webrtc::VoEHardware, public webrtc::VoENetEqStats, 165 public webrtc::VoEHardware,
185 public webrtc::VoENetwork, public webrtc::VoERTP_RTCP, 166 public webrtc::VoENetwork, public webrtc::VoERTP_RTCP,
186 public webrtc::VoEVideoSync, public webrtc::VoEVolumeControl { 167 public webrtc::VoEVolumeControl {
187 public: 168 public:
188 struct DtmfInfo { 169 struct DtmfInfo {
189 DtmfInfo() 170 DtmfInfo()
190 : dtmf_event_code(-1), 171 : dtmf_event_code(-1),
191 dtmf_out_of_band(false), 172 dtmf_out_of_band(false),
192 dtmf_length_ms(-1) {} 173 dtmf_length_ms(-1) {}
193 int dtmf_event_code; 174 int dtmf_event_code;
194 bool dtmf_out_of_band; 175 bool dtmf_out_of_band;
195 int dtmf_length_ms; 176 int dtmf_length_ms;
196 }; 177 };
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 channels_[channel]->send_codec = codec; 501 channels_[channel]->send_codec = codec;
521 ++num_set_send_codecs_; 502 ++num_set_send_codecs_;
522 return 0; 503 return 0;
523 } 504 }
524 WEBRTC_FUNC(GetSendCodec, (int channel, webrtc::CodecInst& codec)) { 505 WEBRTC_FUNC(GetSendCodec, (int channel, webrtc::CodecInst& codec)) {
525 WEBRTC_CHECK_CHANNEL(channel); 506 WEBRTC_CHECK_CHANNEL(channel);
526 codec = channels_[channel]->send_codec; 507 codec = channels_[channel]->send_codec;
527 return 0; 508 return 0;
528 } 509 }
529 WEBRTC_STUB(SetBitRate, (int channel, int bitrate_bps)); 510 WEBRTC_STUB(SetBitRate, (int channel, int bitrate_bps));
530 WEBRTC_FUNC(GetRecCodec, (int channel, webrtc::CodecInst& codec)) { 511 WEBRTC_STUB(GetRecCodec, (int channel, webrtc::CodecInst& codec));
531 WEBRTC_CHECK_CHANNEL(channel);
532 const Channel* c = channels_[channel];
533 for (std::list<std::string>::const_iterator it_packet = c->packets.begin();
534 it_packet != c->packets.end(); ++it_packet) {
535 int pltype;
536 if (!GetRtpPayloadType(it_packet->data(), it_packet->length(), &pltype)) {
537 continue;
538 }
539 for (std::vector<webrtc::CodecInst>::const_iterator it_codec =
540 c->recv_codecs.begin(); it_codec != c->recv_codecs.end();
541 ++it_codec) {
542 if (it_codec->pltype == pltype) {
543 codec = *it_codec;
544 return 0;
545 }
546 }
547 }
548 return -1;
549 }
550 WEBRTC_FUNC(SetRecPayloadType, (int channel, 512 WEBRTC_FUNC(SetRecPayloadType, (int channel,
551 const webrtc::CodecInst& codec)) { 513 const webrtc::CodecInst& codec)) {
552 WEBRTC_CHECK_CHANNEL(channel); 514 WEBRTC_CHECK_CHANNEL(channel);
553 Channel* ch = channels_[channel]; 515 Channel* ch = channels_[channel];
554 if (ch->playout) 516 if (ch->playout)
555 return -1; // Channel is in use. 517 return -1; // Channel is in use.
556 // Check if something else already has this slot. 518 // Check if something else already has this slot.
557 if (codec.pltype != -1) { 519 if (codec.pltype != -1) {
558 for (std::vector<webrtc::CodecInst>::iterator it = 520 for (std::vector<webrtc::CodecInst>::iterator it =
559 ch->recv_codecs.begin(); it != ch->recv_codecs.end(); ++it) { 521 ch->recv_codecs.begin(); it != ch->recv_codecs.end(); ++it) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 *samples_per_sec = playout_sample_rate_; 680 *samples_per_sec = playout_sample_rate_;
719 return 0; 681 return 0;
720 } 682 }
721 WEBRTC_STUB(EnableBuiltInAEC, (bool enable)); 683 WEBRTC_STUB(EnableBuiltInAEC, (bool enable));
722 virtual bool BuiltInAECIsAvailable() const { return false; } 684 virtual bool BuiltInAECIsAvailable() const { return false; }
723 WEBRTC_STUB(EnableBuiltInAGC, (bool enable)); 685 WEBRTC_STUB(EnableBuiltInAGC, (bool enable));
724 virtual bool BuiltInAGCIsAvailable() const { return false; } 686 virtual bool BuiltInAGCIsAvailable() const { return false; }
725 WEBRTC_STUB(EnableBuiltInNS, (bool enable)); 687 WEBRTC_STUB(EnableBuiltInNS, (bool enable));
726 virtual bool BuiltInNSIsAvailable() const { return false; } 688 virtual bool BuiltInNSIsAvailable() const { return false; }
727 689
728 // webrtc::VoENetEqStats
729 WEBRTC_FUNC(GetNetworkStatistics, (int channel,
730 webrtc::NetworkStatistics& ns)) {
731 WEBRTC_CHECK_CHANNEL(channel);
732 memcpy(&ns, &kNetStats, sizeof(webrtc::NetworkStatistics));
733 return 0;
734 }
735
736 WEBRTC_FUNC_CONST(GetDecodingCallStatistics, (int channel,
737 webrtc::AudioDecodingCallStats*)) {
738 WEBRTC_CHECK_CHANNEL(channel);
739 return 0;
740 }
741
742 // webrtc::VoENetwork 690 // webrtc::VoENetwork
743 WEBRTC_FUNC(RegisterExternalTransport, (int channel, 691 WEBRTC_FUNC(RegisterExternalTransport, (int channel,
744 webrtc::Transport& transport)) { 692 webrtc::Transport& transport)) {
745 WEBRTC_CHECK_CHANNEL(channel); 693 WEBRTC_CHECK_CHANNEL(channel);
746 channels_[channel]->external_transport = true; 694 channels_[channel]->external_transport = true;
747 return 0; 695 return 0;
748 } 696 }
749 WEBRTC_FUNC(DeRegisterExternalTransport, (int channel)) { 697 WEBRTC_FUNC(DeRegisterExternalTransport, (int channel)) {
750 WEBRTC_CHECK_CHANNEL(channel); 698 WEBRTC_CHECK_CHANNEL(channel);
751 channels_[channel]->external_transport = false; 699 channels_[channel]->external_transport = false;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 redPayloadtype = channels_[channel]->red_type; 828 redPayloadtype = channels_[channel]->red_type;
881 return 0; 829 return 0;
882 } 830 }
883 WEBRTC_FUNC(SetNACKStatus, (int channel, bool enable, int maxNoPackets)) { 831 WEBRTC_FUNC(SetNACKStatus, (int channel, bool enable, int maxNoPackets)) {
884 WEBRTC_CHECK_CHANNEL(channel); 832 WEBRTC_CHECK_CHANNEL(channel);
885 channels_[channel]->nack = enable; 833 channels_[channel]->nack = enable;
886 channels_[channel]->nack_max_packets = maxNoPackets; 834 channels_[channel]->nack_max_packets = maxNoPackets;
887 return 0; 835 return 0;
888 } 836 }
889 837
890 // webrtc::VoEVideoSync
891 WEBRTC_STUB(GetPlayoutBufferSize, (int& bufferMs));
892 WEBRTC_STUB(GetPlayoutTimestamp, (int channel, unsigned int& timestamp));
893 WEBRTC_STUB(GetRtpRtcp, (int, webrtc::RtpRtcp**, webrtc::RtpReceiver**));
894 WEBRTC_STUB(SetInitTimestamp, (int channel, unsigned int timestamp));
895 WEBRTC_STUB(SetInitSequenceNumber, (int channel, short sequenceNumber));
896 WEBRTC_STUB(SetMinimumPlayoutDelay, (int channel, int delayMs));
897 WEBRTC_STUB(SetInitialPlayoutDelay, (int channel, int delay_ms));
898 WEBRTC_STUB(GetDelayEstimate, (int channel, int* jitter_buffer_delay_ms,
899 int* playout_buffer_delay_ms));
900 WEBRTC_STUB_CONST(GetLeastRequiredDelayMs, (int channel));
901
902 // webrtc::VoEVolumeControl 838 // webrtc::VoEVolumeControl
903 WEBRTC_STUB(SetSpeakerVolume, (unsigned int)); 839 WEBRTC_STUB(SetSpeakerVolume, (unsigned int));
904 WEBRTC_STUB(GetSpeakerVolume, (unsigned int&)); 840 WEBRTC_STUB(GetSpeakerVolume, (unsigned int&));
905 WEBRTC_STUB(SetMicVolume, (unsigned int)); 841 WEBRTC_STUB(SetMicVolume, (unsigned int));
906 WEBRTC_STUB(GetMicVolume, (unsigned int&)); 842 WEBRTC_STUB(GetMicVolume, (unsigned int&));
907 WEBRTC_STUB(SetInputMute, (int, bool)); 843 WEBRTC_STUB(SetInputMute, (int, bool));
908 WEBRTC_STUB(GetInputMute, (int, bool&)); 844 WEBRTC_STUB(GetInputMute, (int, bool&));
909 WEBRTC_STUB(GetSpeechInputLevel, (unsigned int&)); 845 WEBRTC_STUB(GetSpeechInputLevel, (unsigned int&));
910 WEBRTC_STUB(GetSpeechOutputLevel, (int, unsigned int&)); 846 WEBRTC_STUB(GetSpeechOutputLevel, (int, unsigned int&));
911 WEBRTC_STUB(GetSpeechInputLevelFullRange, (unsigned int&)); 847 WEBRTC_STUB(GetSpeechInputLevelFullRange, (unsigned int&));
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 int playout_sample_rate_; 1054 int playout_sample_rate_;
1119 DtmfInfo dtmf_info_; 1055 DtmfInfo dtmf_info_;
1120 FakeAudioProcessing audio_processing_; 1056 FakeAudioProcessing audio_processing_;
1121 }; 1057 };
1122 1058
1123 #undef WEBRTC_CHECK_HEADER_EXTENSION_ID 1059 #undef WEBRTC_CHECK_HEADER_EXTENSION_ID
1124 1060
1125 } // namespace cricket 1061 } // namespace cricket
1126 1062
1127 #endif // TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_ 1063 #endif // TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_
OLDNEW
« no previous file with comments | « talk/media/webrtc/fakewebrtccall.cc ('k') | talk/media/webrtc/webrtcvoe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698