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

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

Issue 1414743004: Implement AudioSendStream::GetStats(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: workaround for android build issue Created 5 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
« no previous file with comments | « talk/media/webrtc/fakewebrtccall.cc ('k') | talk/media/webrtc/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 * 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 27 matching lines...) Expand all
38 #include "talk/media/webrtc/webrtcvoe.h" 38 #include "talk/media/webrtc/webrtcvoe.h"
39 #include "webrtc/base/basictypes.h" 39 #include "webrtc/base/basictypes.h"
40 #include "webrtc/base/checks.h" 40 #include "webrtc/base/checks.h"
41 #include "webrtc/base/gunit.h" 41 #include "webrtc/base/gunit.h"
42 #include "webrtc/base/stringutils.h" 42 #include "webrtc/base/stringutils.h"
43 #include "webrtc/config.h" 43 #include "webrtc/config.h"
44 #include "webrtc/modules/audio_processing/include/audio_processing.h" 44 #include "webrtc/modules/audio_processing/include/audio_processing.h"
45 45
46 namespace cricket { 46 namespace cricket {
47 47
48 // Function returning stats will return these values
49 // for all values based on type.
50 const int kIntStatValue = 123;
51 const float kFractionLostStatValue = 0.5;
52
53 static const char kFakeDefaultDeviceName[] = "Fake Default"; 48 static const char kFakeDefaultDeviceName[] = "Fake Default";
54 static const int kFakeDefaultDeviceId = -1; 49 static const int kFakeDefaultDeviceId = -1;
55 static const char kFakeDeviceName[] = "Fake Device"; 50 static const char kFakeDeviceName[] = "Fake Device";
56 #ifdef WIN32 51 #ifdef WIN32
57 static const int kFakeDeviceId = 0; 52 static const int kFakeDeviceId = 0;
58 #else 53 #else
59 static const int kFakeDeviceId = 1; 54 static const int kFakeDeviceId = 1;
60 #endif 55 #endif
61 56
62 static const int kOpusBandwidthNb = 4000; 57 static const int kOpusBandwidthNb = 4000;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 256 }
262 ~FakeWebRtcVoiceEngine() { 257 ~FakeWebRtcVoiceEngine() {
263 // Ought to have all been deleted by the WebRtcVoiceMediaChannel 258 // Ought to have all been deleted by the WebRtcVoiceMediaChannel
264 // destructors, but just in case ... 259 // destructors, but just in case ...
265 for (std::map<int, Channel*>::const_iterator i = channels_.begin(); 260 for (std::map<int, Channel*>::const_iterator i = channels_.begin();
266 i != channels_.end(); ++i) { 261 i != channels_.end(); ++i) {
267 delete i->second; 262 delete i->second;
268 } 263 }
269 } 264 }
270 265
266 bool ec_metrics_enabled() const { return ec_metrics_enabled_; }
267
271 bool IsInited() const { return inited_; } 268 bool IsInited() const { return inited_; }
272 int GetLastChannel() const { return last_channel_; } 269 int GetLastChannel() const { return last_channel_; }
273 int GetChannelFromLocalSsrc(uint32_t local_ssrc) const { 270 int GetChannelFromLocalSsrc(uint32_t local_ssrc) const {
274 for (std::map<int, Channel*>::const_iterator iter = channels_.begin(); 271 for (std::map<int, Channel*>::const_iterator iter = channels_.begin();
275 iter != channels_.end(); ++iter) { 272 iter != channels_.end(); ++iter) {
276 if (local_ssrc == iter->second->send_ssrc) 273 if (local_ssrc == iter->second->send_ssrc)
277 return iter->first; 274 return iter->first;
278 } 275 }
279 return -1; 276 return -1;
280 } 277 }
281 int GetNumChannels() const { return static_cast<int>(channels_.size()); } 278 int GetNumChannels() const { return static_cast<int>(channels_.size()); }
279 uint32_t GetLocalSSRC(int channel) {
280 return channels_[channel]->send_ssrc;
281 }
282 bool GetPlayout(int channel) { 282 bool GetPlayout(int channel) {
283 return channels_[channel]->playout; 283 return channels_[channel]->playout;
284 } 284 }
285 bool GetSend(int channel) { 285 bool GetSend(int channel) {
286 return channels_[channel]->send; 286 return channels_[channel]->send;
287 } 287 }
288 bool GetVAD(int channel) { 288 bool GetVAD(int channel) {
289 return channels_[channel]->vad; 289 return channels_[channel]->vad;
290 } 290 }
291 bool GetOpusDtx(int channel) { 291 bool GetOpusDtx(int channel) {
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 720
721 WEBRTC_STUB(ReceivedRTCPPacket, (int channel, const void* data, 721 WEBRTC_STUB(ReceivedRTCPPacket, (int channel, const void* data,
722 size_t length)); 722 size_t length));
723 723
724 // webrtc::VoERTP_RTCP 724 // webrtc::VoERTP_RTCP
725 WEBRTC_FUNC(SetLocalSSRC, (int channel, unsigned int ssrc)) { 725 WEBRTC_FUNC(SetLocalSSRC, (int channel, unsigned int ssrc)) {
726 WEBRTC_CHECK_CHANNEL(channel); 726 WEBRTC_CHECK_CHANNEL(channel);
727 channels_[channel]->send_ssrc = ssrc; 727 channels_[channel]->send_ssrc = ssrc;
728 return 0; 728 return 0;
729 } 729 }
730 WEBRTC_FUNC(GetLocalSSRC, (int channel, unsigned int& ssrc)) { 730 WEBRTC_STUB(GetLocalSSRC, (int channel, unsigned int& ssrc));
731 WEBRTC_CHECK_CHANNEL(channel);
732 ssrc = channels_[channel]->send_ssrc;
733 return 0;
734 }
735 WEBRTC_STUB(GetRemoteSSRC, (int channel, unsigned int& ssrc)); 731 WEBRTC_STUB(GetRemoteSSRC, (int channel, unsigned int& ssrc));
736 WEBRTC_FUNC(SetSendAudioLevelIndicationStatus, (int channel, bool enable, 732 WEBRTC_FUNC(SetSendAudioLevelIndicationStatus, (int channel, bool enable,
737 unsigned char id)) { 733 unsigned char id)) {
738 WEBRTC_CHECK_CHANNEL(channel); 734 WEBRTC_CHECK_CHANNEL(channel);
739 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id); 735 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id);
740 channels_[channel]->send_audio_level_ext_ = (enable) ? id : -1; 736 channels_[channel]->send_audio_level_ext_ = (enable) ? id : -1;
741 return 0; 737 return 0;
742 } 738 }
743 WEBRTC_FUNC(SetReceiveAudioLevelIndicationStatus, (int channel, bool enable, 739 WEBRTC_FUNC(SetReceiveAudioLevelIndicationStatus, (int channel, bool enable,
744 unsigned char id)) { 740 unsigned char id)) {
(...skipping 21 matching lines...) Expand all
766 WEBRTC_STUB(GetRTCPStatus, (int channel, bool& enabled)); 762 WEBRTC_STUB(GetRTCPStatus, (int channel, bool& enabled));
767 WEBRTC_STUB(SetRTCP_CNAME, (int channel, const char cname[256])); 763 WEBRTC_STUB(SetRTCP_CNAME, (int channel, const char cname[256]));
768 WEBRTC_STUB(GetRTCP_CNAME, (int channel, char cname[256])); 764 WEBRTC_STUB(GetRTCP_CNAME, (int channel, char cname[256]));
769 WEBRTC_STUB(GetRemoteRTCP_CNAME, (int channel, char* cname)); 765 WEBRTC_STUB(GetRemoteRTCP_CNAME, (int channel, char* cname));
770 WEBRTC_STUB(GetRemoteRTCPData, (int channel, unsigned int& NTPHigh, 766 WEBRTC_STUB(GetRemoteRTCPData, (int channel, unsigned int& NTPHigh,
771 unsigned int& NTPLow, 767 unsigned int& NTPLow,
772 unsigned int& timestamp, 768 unsigned int& timestamp,
773 unsigned int& playoutTimestamp, 769 unsigned int& playoutTimestamp,
774 unsigned int* jitter, 770 unsigned int* jitter,
775 unsigned short* fractionLost)); 771 unsigned short* fractionLost));
776 WEBRTC_FUNC(GetRemoteRTCPReportBlocks, 772 WEBRTC_STUB(GetRemoteRTCPReportBlocks,
777 (int channel, std::vector<webrtc::ReportBlock>* receive_blocks)) { 773 (int channel, std::vector<webrtc::ReportBlock>* receive_blocks));
778 WEBRTC_CHECK_CHANNEL(channel);
779 webrtc::ReportBlock block;
780 block.source_SSRC = channels_[channel]->send_ssrc;
781 webrtc::CodecInst send_codec = channels_[channel]->send_codec;
782 if (send_codec.pltype >= 0) {
783 block.fraction_lost = (unsigned char)(kFractionLostStatValue * 256);
784 if (send_codec.plfreq / 1000 > 0) {
785 block.interarrival_jitter = kIntStatValue * (send_codec.plfreq / 1000);
786 }
787 block.cumulative_num_packets_lost = kIntStatValue;
788 block.extended_highest_sequence_number = kIntStatValue;
789 receive_blocks->push_back(block);
790 }
791 return 0;
792 }
793 WEBRTC_STUB(GetRTPStatistics, (int channel, unsigned int& averageJitterMs, 774 WEBRTC_STUB(GetRTPStatistics, (int channel, unsigned int& averageJitterMs,
794 unsigned int& maxJitterMs, 775 unsigned int& maxJitterMs,
795 unsigned int& discardedPackets)); 776 unsigned int& discardedPackets));
796 WEBRTC_FUNC(GetRTCPStatistics, (int channel, webrtc::CallStatistics& stats)) { 777 WEBRTC_STUB(GetRTCPStatistics, (int channel, webrtc::CallStatistics& stats));
797 WEBRTC_CHECK_CHANNEL(channel);
798 stats.fractionLost = static_cast<int16_t>(kIntStatValue);
799 stats.cumulativeLost = kIntStatValue;
800 stats.extendedMax = kIntStatValue;
801 stats.jitterSamples = kIntStatValue;
802 stats.rttMs = kIntStatValue;
803 stats.bytesSent = kIntStatValue;
804 stats.packetsSent = kIntStatValue;
805 stats.bytesReceived = kIntStatValue;
806 stats.packetsReceived = kIntStatValue;
807 return 0;
808 }
809 WEBRTC_FUNC(SetREDStatus, (int channel, bool enable, int redPayloadtype)) { 778 WEBRTC_FUNC(SetREDStatus, (int channel, bool enable, int redPayloadtype)) {
810 return SetFECStatus(channel, enable, redPayloadtype); 779 return SetFECStatus(channel, enable, redPayloadtype);
811 } 780 }
812 // TODO(minyue): remove the below function when transition to SetREDStatus 781 // TODO(minyue): remove the below function when transition to SetREDStatus
813 // is finished. 782 // is finished.
814 WEBRTC_FUNC(SetFECStatus, (int channel, bool enable, int redPayloadtype)) { 783 WEBRTC_FUNC(SetFECStatus, (int channel, bool enable, int redPayloadtype)) {
815 WEBRTC_CHECK_CHANNEL(channel); 784 WEBRTC_CHECK_CHANNEL(channel);
816 channels_[channel]->red = enable; 785 channels_[channel]->red = enable;
817 channels_[channel]->red_type = redPayloadtype; 786 channels_[channel]->red_type = redPayloadtype;
818 return 0; 787 return 0;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 WEBRTC_STUB(SetRxAgcConfig, (int channel, webrtc::AgcConfig config)); 893 WEBRTC_STUB(SetRxAgcConfig, (int channel, webrtc::AgcConfig config));
925 WEBRTC_STUB(GetRxAgcConfig, (int channel, webrtc::AgcConfig& config)); 894 WEBRTC_STUB(GetRxAgcConfig, (int channel, webrtc::AgcConfig& config));
926 895
927 WEBRTC_STUB(RegisterRxVadObserver, (int, webrtc::VoERxVadCallback&)); 896 WEBRTC_STUB(RegisterRxVadObserver, (int, webrtc::VoERxVadCallback&));
928 WEBRTC_STUB(DeRegisterRxVadObserver, (int channel)); 897 WEBRTC_STUB(DeRegisterRxVadObserver, (int channel));
929 WEBRTC_STUB(VoiceActivityIndicator, (int channel)); 898 WEBRTC_STUB(VoiceActivityIndicator, (int channel));
930 WEBRTC_FUNC(SetEcMetricsStatus, (bool enable)) { 899 WEBRTC_FUNC(SetEcMetricsStatus, (bool enable)) {
931 ec_metrics_enabled_ = enable; 900 ec_metrics_enabled_ = enable;
932 return 0; 901 return 0;
933 } 902 }
934 WEBRTC_FUNC(GetEcMetricsStatus, (bool& enabled)) { 903 WEBRTC_STUB(GetEcMetricsStatus, (bool& enabled));
935 enabled = ec_metrics_enabled_;
936 return 0;
937 }
938 WEBRTC_STUB(GetEchoMetrics, (int& ERL, int& ERLE, int& RERL, int& A_NLP)); 904 WEBRTC_STUB(GetEchoMetrics, (int& ERL, int& ERLE, int& RERL, int& A_NLP));
939 WEBRTC_STUB(GetEcDelayMetrics, (int& delay_median, int& delay_std, 905 WEBRTC_STUB(GetEcDelayMetrics, (int& delay_median, int& delay_std,
940 float& fraction_poor_delays)); 906 float& fraction_poor_delays));
941 907
942 WEBRTC_STUB(StartDebugRecording, (const char* fileNameUTF8)); 908 WEBRTC_STUB(StartDebugRecording, (const char* fileNameUTF8));
943 WEBRTC_STUB(StartDebugRecording, (FILE* handle)); 909 WEBRTC_STUB(StartDebugRecording, (FILE* handle));
944 WEBRTC_STUB(StopDebugRecording, ()); 910 WEBRTC_STUB(StopDebugRecording, ());
945 911
946 WEBRTC_FUNC(SetTypingDetectionStatus, (bool enable)) { 912 WEBRTC_FUNC(SetTypingDetectionStatus, (bool enable)) {
947 typing_detection_enabled_ = enable; 913 typing_detection_enabled_ = enable;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 int playout_sample_rate_; 1020 int playout_sample_rate_;
1055 DtmfInfo dtmf_info_; 1021 DtmfInfo dtmf_info_;
1056 FakeAudioProcessing audio_processing_; 1022 FakeAudioProcessing audio_processing_;
1057 }; 1023 };
1058 1024
1059 #undef WEBRTC_CHECK_HEADER_EXTENSION_ID 1025 #undef WEBRTC_CHECK_HEADER_EXTENSION_ID
1060 1026
1061 } // namespace cricket 1027 } // namespace cricket
1062 1028
1063 #endif // TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_ 1029 #endif // TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_
OLDNEW
« no previous file with comments | « talk/media/webrtc/fakewebrtccall.cc ('k') | talk/media/webrtc/webrtcvoiceengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698