diff options
-rw-r--r-- | MumbleKit.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | src/MKAudio.m | 6 | ||||
-rw-r--r-- | src/MKAudioInput.m | 20 | ||||
-rw-r--r-- | src/MumbleKit/MKAudio.h | 18 | ||||
-rw-r--r-- | src/dummy.c | 0 | ||||
-rw-r--r-- | src/timedelta.h | 68 |
6 files changed, 1 insertions, 117 deletions
diff --git a/MumbleKit.xcodeproj/project.pbxproj b/MumbleKit.xcodeproj/project.pbxproj index 549404e..aaee006 100644 --- a/MumbleKit.xcodeproj/project.pbxproj +++ b/MumbleKit.xcodeproj/project.pbxproj @@ -55,8 +55,6 @@ 2845A7BF132D9C400034D631 /* MKUserPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2845A7BB132D9C400034D631 /* MKUserPrivate.h */; }; 2845A7C0132D9C400034D631 /* MulticastDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2845A7BC132D9C400034D631 /* MulticastDelegate.h */; }; 2845A7C1132D9C400034D631 /* MulticastDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2845A7BC132D9C400034D631 /* MulticastDelegate.h */; }; - 2845A7C2132D9C400034D631 /* timedelta.h in Headers */ = {isa = PBXBuildFile; fileRef = 2845A7BD132D9C400034D631 /* timedelta.h */; }; - 2845A7C3132D9C400034D631 /* timedelta.h in Headers */ = {isa = PBXBuildFile; fileRef = 2845A7BD132D9C400034D631 /* timedelta.h */; }; 2845A7C5132D9C460034D631 /* CryptState.h in Headers */ = {isa = PBXBuildFile; fileRef = 2845A7C4132D9C460034D631 /* CryptState.h */; }; 2845A7C6132D9C460034D631 /* CryptState.h in Headers */ = {isa = PBXBuildFile; fileRef = 2845A7C4132D9C460034D631 /* CryptState.h */; }; 2845A7D9132D9C520034D631 /* MKAudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 2845A7C7132D9C520034D631 /* MKAudio.h */; }; @@ -324,7 +322,6 @@ 2845A793132D9C220034D631 /* MulticastDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MulticastDelegate.m; path = src/MulticastDelegate.m; sourceTree = SOURCE_ROOT; }; 2845A7BB132D9C400034D631 /* MKUserPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MKUserPrivate.h; path = src/MKUserPrivate.h; sourceTree = SOURCE_ROOT; }; 2845A7BC132D9C400034D631 /* MulticastDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MulticastDelegate.h; path = src/MulticastDelegate.h; sourceTree = SOURCE_ROOT; }; - 2845A7BD132D9C400034D631 /* timedelta.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = timedelta.h; path = src/timedelta.h; sourceTree = SOURCE_ROOT; }; 2845A7C4132D9C460034D631 /* CryptState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CryptState.h; path = src/CryptState.h; sourceTree = SOURCE_ROOT; }; 2845A7C7132D9C520034D631 /* MKAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MKAudio.h; path = src/MumbleKit/MKAudio.h; sourceTree = SOURCE_ROOT; }; 2845A7C8132D9C520034D631 /* MKAudioInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MKAudioInput.h; path = src/MKAudioInput.h; sourceTree = SOURCE_ROOT; }; @@ -494,7 +491,6 @@ 2845A7C4132D9C460034D631 /* CryptState.h */, 2845A7BB132D9C400034D631 /* MKUserPrivate.h */, 2845A7BC132D9C400034D631 /* MulticastDelegate.h */, - 2845A7BD132D9C400034D631 /* timedelta.h */, 28F2FAD413E37BA000034BF2 /* MKAudioOutputUserPrivate.h */, 2845A7C8132D9C520034D631 /* MKAudioInput.h */, 2845A7C9132D9C520034D631 /* MKAudioOutput.h */, @@ -638,7 +634,6 @@ 2845A7E2132D9C520034D631 /* MKAudioOutputUser.h in Headers */, 2845A7BF132D9C400034D631 /* MKUserPrivate.h in Headers */, 2845A7C1132D9C400034D631 /* MulticastDelegate.h in Headers */, - 2845A7C3132D9C400034D631 /* timedelta.h in Headers */, 2845A7C6132D9C460034D631 /* CryptState.h in Headers */, 28F2FAD613E37BA000034BF2 /* MKAudioOutputUserPrivate.h in Headers */, 2808DD9413E4D8C0008448EA /* MKPacketDataStream.h in Headers */, @@ -652,7 +647,6 @@ files = ( 2845A7BE132D9C400034D631 /* MKUserPrivate.h in Headers */, 2845A7C0132D9C400034D631 /* MulticastDelegate.h in Headers */, - 2845A7C2132D9C400034D631 /* timedelta.h in Headers */, 2845A7C5132D9C460034D631 /* CryptState.h in Headers */, 2845A7D9132D9C520034D631 /* MKAudio.h in Headers */, 2845A7DB132D9C520034D631 /* MKAudioInput.h in Headers */, diff --git a/src/MKAudio.m b/src/MKAudio.m index b84eb71..7e8d760 100644 --- a/src/MKAudio.m +++ b/src/MKAudio.m @@ -277,12 +277,6 @@ static void MKAudio_AudioRouteChangedCallback(MKAudio *audio, AudioSessionProper [_audioInput setForceTransmit:flag]; } -- (void) getBenchmarkData:(MKAudioBenchmark *)bench { - if (bench != NULL) { - bench->avgPreprocessorRuntime = [_audioInput preprocessorAvgRuntime]; - } -} - - (NSString *) currentAudioRoute { #if TARGET_OS_IPHONE == 1 // Query for the actual sample rate we're to cope with. diff --git a/src/MKAudioInput.m b/src/MKAudioInput.m index babd050..9230089 100644 --- a/src/MKAudioInput.m +++ b/src/MKAudioInput.m @@ -45,8 +45,6 @@ #include <celt.h> #include <opus.h> -#include "timedelta.h" - @interface MKAudioInput () { @public AudioUnit audioUnit; @@ -606,23 +604,7 @@ static OSStatus inputCallback(void *udata, AudioUnitRenderActionFlags *flags, co int isSpeech = 0; if (_settings.enablePreprocessor) { -#if 1 - if (_settings.enableBenchmark) { - TimeDelta td; - TimeDelta_start(&td); - isSpeech = speex_preprocess_run(_preprocessorState, psMic); - TimeDelta_stop(&td); - unsigned long udt = TimeDelta_usec_delta(&td); - if (_preprocAvgItems == 0) - _preprocRunningAvg = (long)udt; - else - _preprocRunningAvg += (((long)udt - _preprocRunningAvg) / _preprocAvgItems); - ++_preprocAvgItems; - } else -#endif - { - isSpeech = speex_preprocess_run(_preprocessorState, psMic); - } + isSpeech = speex_preprocess_run(_preprocessorState, psMic); } else { BOOL resampled = micFrequency != sampleRate; short *buf = resampled ? psOut : psMic; diff --git a/src/MumbleKit/MKAudio.h b/src/MumbleKit/MKAudio.h index 380f424..a1b3182 100644 --- a/src/MumbleKit/MKAudio.h +++ b/src/MumbleKit/MKAudio.h @@ -68,14 +68,8 @@ typedef struct _MKAudioSettings { int outputDelay; float micBoost; BOOL enablePreprocessor; - BOOL enableBenchmark; } MKAudioSettings; -typedef struct _MKAudioBenchmark { - signed long avgPreprocessorRuntime; -} MKAudioBenchmark; - - /** * MKAudio represents the MumbleKit audio subsystem. */ @@ -156,19 +150,7 @@ typedef struct _MKAudioBenchmark { */ - (void) setForceTransmit:(BOOL)enableForceTransmit; -///---------------- -/// @name Benchmark -///---------------- - -/** - * Fills a MKAudioBenchmark struct with the current benchmark data. - * - * @param bench The struct to fill out with benchmark data. Should point to a MKAudioBenchmark struct. - */ -- (void) getBenchmarkData:(MKAudioBenchmark *)bench; - - (NSString *) currentAudioRoute; - - (float) speechProbablity; - (float) peakCleanMic; diff --git a/src/dummy.c b/src/dummy.c deleted file mode 100644 index e69de29..0000000 --- a/src/dummy.c +++ /dev/null diff --git a/src/timedelta.h b/src/timedelta.h deleted file mode 100644 index 6458ab5..0000000 --- a/src/timedelta.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (C) 2010 Mikkel Krautz <mikkel@krautz.dk> - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the Mumble Developers nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef __TIMEDELTA_H__ -#define __TIMEDELTA_H__ - -#include <assert.h> -#include <sys/time.h> - -#define TIMEDELTA_USEC_PER_SEC 1000000UL - -typedef struct _TimeDelta { - struct timeval tv1, tv2; -} TimeDelta; - -static inline void -TimeDelta_start(TimeDelta *td) -{ - assert(gettimeofday(&td->tv1, NULL) == 0); -} - -static inline void -TimeDelta_stop(TimeDelta *td) -{ - assert(gettimeofday(&td->tv2, NULL) == 0); -} - -static inline unsigned long -TimeDelta_usec_delta(TimeDelta *td) { - time_t sdt = td->tv2.tv_sec - td->tv1.tv_sec; - // sdt > 0 means usec wrap around + (sdt-1)*USEC_PER_SEC - unsigned long udt = 0; - if (sdt > 0) { - udt = (TIMEDELTA_USEC_PER_SEC - td->tv1.tv_usec) + td->tv2.tv_usec + (sdt-1) * TIMEDELTA_USEC_PER_SEC; - } else { - udt = td->tv2.tv_usec - td->tv1.tv_usec; - } - return udt; -} - -#endif /* __TIMEDELTA_H__ */ |