Skip to content

Commit

Permalink
Renamed "Realtime safety monitor" to "Realtime watchdog", revised init
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeltyson committed Jun 13, 2016
1 parent 63fd57f commit 6afa17a
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 92 deletions.
52 changes: 26 additions & 26 deletions TheAmazingAudioEngine.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
4C43E5AD1CF131290000DB62 /* AEAudioFileReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C43E5A81CF131290000DB62 /* AEAudioFileReader.m */; };
4C43E5AE1CF131290000DB62 /* AEAudioFileReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C43E5A81CF131290000DB62 /* AEAudioFileReader.m */; };
4C43E5B01CF14A340000DB62 /* AEAudioFileReadWriteTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C43E5AF1CF14A340000DB62 /* AEAudioFileReadWriteTests.m */; };
4C636E0D1D0D2E54005A380B /* AERealtimeSafetyMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E091D0D2E54005A380B /* AERealtimeSafetyMonitor.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
4C636E0E1D0D2E54005A380B /* AERealtimeSafetyMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E091D0D2E54005A380B /* AERealtimeSafetyMonitor.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
4C636E0F1D0D2E54005A380B /* AERealtimeSafetyMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E091D0D2E54005A380B /* AERealtimeSafetyMonitor.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
4C636E211D0D7BED005A380B /* AERealtimeSafetyMonitor-simulator-x86_64.s in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E201D0D7BED005A380B /* AERealtimeSafetyMonitor-simulator-x86_64.s */; settings = {COMPILER_FLAGS = "-fno-modules"; }; };
4C636E221D0D7BED005A380B /* AERealtimeSafetyMonitor-simulator-x86_64.s in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E201D0D7BED005A380B /* AERealtimeSafetyMonitor-simulator-x86_64.s */; settings = {COMPILER_FLAGS = "-fno-modules"; }; };
4C636E231D0D7BED005A380B /* AERealtimeSafetyMonitor-simulator-x86_64.s in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E201D0D7BED005A380B /* AERealtimeSafetyMonitor-simulator-x86_64.s */; settings = {COMPILER_FLAGS = "-fno-modules"; }; };
4C636E251D0D7BFE005A380B /* AERealtimeSafetyMonitor-arm64.s in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E241D0D7BFE005A380B /* AERealtimeSafetyMonitor-arm64.s */; };
4C636E261D0D7BFE005A380B /* AERealtimeSafetyMonitor-arm64.s in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E241D0D7BFE005A380B /* AERealtimeSafetyMonitor-arm64.s */; };
4C636E271D0D7BFE005A380B /* AERealtimeSafetyMonitor-arm64.s in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E241D0D7BFE005A380B /* AERealtimeSafetyMonitor-arm64.s */; };
4C636E0D1D0D2E54005A380B /* AERealtimeWatchdog.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E091D0D2E54005A380B /* AERealtimeWatchdog.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
4C636E0E1D0D2E54005A380B /* AERealtimeWatchdog.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E091D0D2E54005A380B /* AERealtimeWatchdog.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
4C636E0F1D0D2E54005A380B /* AERealtimeWatchdog.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E091D0D2E54005A380B /* AERealtimeWatchdog.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
4C636E211D0D7BED005A380B /* AERealtimeWatchdog-simulator-x86_64.s in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E201D0D7BED005A380B /* AERealtimeWatchdog-simulator-x86_64.s */; settings = {COMPILER_FLAGS = "-fno-modules"; }; };
4C636E221D0D7BED005A380B /* AERealtimeWatchdog-simulator-x86_64.s in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E201D0D7BED005A380B /* AERealtimeWatchdog-simulator-x86_64.s */; settings = {COMPILER_FLAGS = "-fno-modules"; }; };
4C636E231D0D7BED005A380B /* AERealtimeWatchdog-simulator-x86_64.s in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E201D0D7BED005A380B /* AERealtimeWatchdog-simulator-x86_64.s */; settings = {COMPILER_FLAGS = "-fno-modules"; }; };
4C636E251D0D7BFE005A380B /* AERealtimeWatchdog-arm64.s in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E241D0D7BFE005A380B /* AERealtimeWatchdog-arm64.s */; };
4C636E261D0D7BFE005A380B /* AERealtimeWatchdog-arm64.s in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E241D0D7BFE005A380B /* AERealtimeWatchdog-arm64.s */; };
4C636E271D0D7BFE005A380B /* AERealtimeWatchdog-arm64.s in Sources */ = {isa = PBXBuildFile; fileRef = 4C636E241D0D7BFE005A380B /* AERealtimeWatchdog-arm64.s */; };
4C77566D1CCB42AA004415A2 /* AESubrendererModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C77566B1CCB42AA004415A2 /* AESubrendererModule.h */; settings = {ATTRIBUTES = (Public, ); }; };
4C77566E1CCB42AA004415A2 /* AESubrendererModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C77566B1CCB42AA004415A2 /* AESubrendererModule.h */; settings = {ATTRIBUTES = (Public, ); }; };
4C77566F1CCB42AA004415A2 /* AESubrendererModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C77566B1CCB42AA004415A2 /* AESubrendererModule.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -343,10 +343,10 @@
4C43E5A71CF131290000DB62 /* AEAudioFileReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AEAudioFileReader.h; sourceTree = "<group>"; };
4C43E5A81CF131290000DB62 /* AEAudioFileReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AEAudioFileReader.m; sourceTree = "<group>"; };
4C43E5AF1CF14A340000DB62 /* AEAudioFileReadWriteTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AEAudioFileReadWriteTests.m; sourceTree = "<group>"; };
4C636E091D0D2E54005A380B /* AERealtimeSafetyMonitor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AERealtimeSafetyMonitor.m; sourceTree = "<group>"; };
4C636E101D0D57A7005A380B /* AERealtimeSafetyMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AERealtimeSafetyMonitor.h; sourceTree = "<group>"; };
4C636E201D0D7BED005A380B /* AERealtimeSafetyMonitor-simulator-x86_64.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = "AERealtimeSafetyMonitor-simulator-x86_64.s"; sourceTree = "<group>"; };
4C636E241D0D7BFE005A380B /* AERealtimeSafetyMonitor-arm64.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = "AERealtimeSafetyMonitor-arm64.s"; sourceTree = "<group>"; };
4C636E091D0D2E54005A380B /* AERealtimeWatchdog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AERealtimeWatchdog.m; sourceTree = "<group>"; };
4C636E101D0D57A7005A380B /* AERealtimeWatchdog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AERealtimeWatchdog.h; sourceTree = "<group>"; };
4C636E201D0D7BED005A380B /* AERealtimeWatchdog-simulator-x86_64.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = "AERealtimeWatchdog-simulator-x86_64.s"; sourceTree = "<group>"; };
4C636E241D0D7BFE005A380B /* AERealtimeWatchdog-arm64.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = "AERealtimeWatchdog-arm64.s"; sourceTree = "<group>"; };
4C77566B1CCB42AA004415A2 /* AESubrendererModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AESubrendererModule.h; sourceTree = "<group>"; };
4C77566C1CCB42AA004415A2 /* AESubrendererModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AESubrendererModule.m; sourceTree = "<group>"; };
4C7756961CD2E5C6004415A2 /* TPCircularBuffer+AudioBufferList.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "TPCircularBuffer+AudioBufferList.c"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -605,10 +605,10 @@
4C43E5A81CF131290000DB62 /* AEAudioFileReader.m */,
4CE10C281D07E507004AA02C /* AEWeakRetainingProxy.h */,
4CE10C291D07E507004AA02C /* AEWeakRetainingProxy.m */,
4C636E101D0D57A7005A380B /* AERealtimeSafetyMonitor.h */,
4C636E091D0D2E54005A380B /* AERealtimeSafetyMonitor.m */,
4C636E241D0D7BFE005A380B /* AERealtimeSafetyMonitor-arm64.s */,
4C636E201D0D7BED005A380B /* AERealtimeSafetyMonitor-simulator-x86_64.s */,
4C636E101D0D57A7005A380B /* AERealtimeWatchdog.h */,
4C636E091D0D2E54005A380B /* AERealtimeWatchdog.m */,
4C636E241D0D7BFE005A380B /* AERealtimeWatchdog-arm64.s */,
4C636E201D0D7BED005A380B /* AERealtimeWatchdog-simulator-x86_64.s */,
);
path = Utilities;
sourceTree = "<group>";
Expand Down Expand Up @@ -956,7 +956,7 @@
buildActionMask = 2147483647;
files = (
4C9F0F2D1CB265F90032903E /* AEParametricEqModule.m in Sources */,
4C636E221D0D7BED005A380B /* AERealtimeSafetyMonitor-simulator-x86_64.s in Sources */,
4C636E221D0D7BED005A380B /* AERealtimeWatchdog-simulator-x86_64.s in Sources */,
4C9F0F2E1CB265F90032903E /* AEHighShelfModule.m in Sources */,
4C9F0F2F1CB265F90032903E /* AEDSPUtilities.m in Sources */,
4C9F0F301CB265F90032903E /* AEPeakLimiterModule.m in Sources */,
Expand Down Expand Up @@ -985,7 +985,7 @@
4C9F0F421CB265F90032903E /* AEAudioFileRecorderModule.m in Sources */,
4C43E5AD1CF131290000DB62 /* AEAudioFileReader.m in Sources */,
4C31831C1CDEC6560085634F /* AEAudioFileOutput.m in Sources */,
4C636E0E1D0D2E54005A380B /* AERealtimeSafetyMonitor.m in Sources */,
4C636E0E1D0D2E54005A380B /* AERealtimeWatchdog.m in Sources */,
4C9F0F431CB265F90032903E /* AEAudioFilePlayerModule.m in Sources */,
4C9F0F441CB265F90032903E /* AEUtilities.m in Sources */,
4C9F0F451CB265F90032903E /* AETypes.m in Sources */,
Expand All @@ -999,7 +999,7 @@
4C3182DD1CDC1EA90085634F /* AERenderContext.m in Sources */,
4C9F0F4B1CB265F90032903E /* AEAudioUnitModule.m in Sources */,
4CE5F4D21CD3169C00322F03 /* AEAudioThreadEndpoint.m in Sources */,
4C636E261D0D7BFE005A380B /* AERealtimeSafetyMonitor-arm64.s in Sources */,
4C636E261D0D7BFE005A380B /* AERealtimeWatchdog-arm64.s in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -1008,7 +1008,7 @@
buildActionMask = 2147483647;
files = (
4C9F0F771CB269C30032903E /* AEParametricEqModule.m in Sources */,
4C636E231D0D7BED005A380B /* AERealtimeSafetyMonitor-simulator-x86_64.s in Sources */,
4C636E231D0D7BED005A380B /* AERealtimeWatchdog-simulator-x86_64.s in Sources */,
4C9F0F781CB269C30032903E /* AEHighShelfModule.m in Sources */,
4C9F0F791CB269C30032903E /* AEDSPUtilities.m in Sources */,
4C9F0F7A1CB269C30032903E /* AEPeakLimiterModule.m in Sources */,
Expand Down Expand Up @@ -1037,7 +1037,7 @@
4C9F0F8C1CB269C30032903E /* AEAudioFileRecorderModule.m in Sources */,
4C43E5AE1CF131290000DB62 /* AEAudioFileReader.m in Sources */,
4C31831D1CDEC6560085634F /* AEAudioFileOutput.m in Sources */,
4C636E0F1D0D2E54005A380B /* AERealtimeSafetyMonitor.m in Sources */,
4C636E0F1D0D2E54005A380B /* AERealtimeWatchdog.m in Sources */,
4C9F0F8D1CB269C30032903E /* AEAudioFilePlayerModule.m in Sources */,
4C9F0F8E1CB269C30032903E /* AEUtilities.m in Sources */,
4C9F0F8F1CB269C30032903E /* AETypes.m in Sources */,
Expand All @@ -1051,7 +1051,7 @@
4C3182DE1CDC1EA90085634F /* AERenderContext.m in Sources */,
4C9F0F951CB269C30032903E /* AEAudioUnitModule.m in Sources */,
4CE5F4D31CD3169C00322F03 /* AEAudioThreadEndpoint.m in Sources */,
4C636E271D0D7BFE005A380B /* AERealtimeSafetyMonitor-arm64.s in Sources */,
4C636E271D0D7BFE005A380B /* AERealtimeWatchdog-arm64.s in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -1061,7 +1061,7 @@
files = (
4CDCAD8B1CA5484D008AAEF1 /* AEParametricEqModule.m in Sources */,
4CDCAD831CA5484D008AAEF1 /* AEHighShelfModule.m in Sources */,
4C636E251D0D7BFE005A380B /* AERealtimeSafetyMonitor-arm64.s in Sources */,
4C636E251D0D7BFE005A380B /* AERealtimeWatchdog-arm64.s in Sources */,
4C94E29A1CADFFB6006EB497 /* AEDSPUtilities.m in Sources */,
4CDCAD8D1CA5484D008AAEF1 /* AEPeakLimiterModule.m in Sources */,
4CDCAD7F1CA5484D008AAEF1 /* AEDynamicsProcessorModule.m in Sources */,
Expand All @@ -1081,7 +1081,7 @@
4CDCAD3C1CA3C31C008AAEF1 /* AEModule.m in Sources */,
4CDCAD7D1CA5484D008AAEF1 /* AEDistortionModule.m in Sources */,
4CDCADBB1CAC95A8008AAEF1 /* AEAudioUnitOutput.m in Sources */,
4C636E0D1D0D2E54005A380B /* AERealtimeSafetyMonitor.m in Sources */,
4C636E0D1D0D2E54005A380B /* AERealtimeWatchdog.m in Sources */,
4CDCAD851CA5484D008AAEF1 /* AELowPassModule.m in Sources */,
4C3183131CDDEFDE0085634F /* AEMixerModule.m in Sources */,
4CDCAD811CA5484D008AAEF1 /* AEHighPassModule.m in Sources */,
Expand All @@ -1094,7 +1094,7 @@
4CDCAD3A1CA3C31C008AAEF1 /* AETypes.m in Sources */,
4CE5F4D11CD3169C00322F03 /* AEAudioThreadEndpoint.m in Sources */,
4C9F0F231CB1E9FC0032903E /* AEIOAudioUnit.m in Sources */,
4C636E211D0D7BED005A380B /* AERealtimeSafetyMonitor-simulator-x86_64.s in Sources */,
4C636E211D0D7BED005A380B /* AERealtimeWatchdog-simulator-x86_64.s in Sources */,
4C31831B1CDEC6560085634F /* AEAudioFileOutput.m in Sources */,
4C94E2CA1CAF95BD006EB497 /* AEManagedValue.m in Sources */,
4C3182DC1CDC1EA90085634F /* AERenderContext.m in Sources */,
Expand Down
4 changes: 0 additions & 4 deletions TheAmazingAudioEngine/Utilities/AEIOAudioUnit.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#import "AETime.h"
#import "AEManagedValue.h"
#import "AEAudioBufferListUtilities.h"
#import "AERealtimeSafetyMonitor.h"
#import <AVFoundation/AVFoundation.h>

NSString * const AEIOAudioUnitDidUpdateStreamFormatNotification = @"AEIOAudioUnitDidUpdateStreamFormatNotification";
Expand Down Expand Up @@ -475,9 +474,6 @@ - (void)setIOBufferDuration:(AESeconds)IOBufferDuration {
static OSStatus AEIOAudioUnitRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber,
UInt32 inNumberFrames, AudioBufferList *ioData) {
#ifdef REALTIME_SAFETY_MONITOR_ENABLED
AERealtimeSafetyMonitorInit(pthread_self());
#endif

// Render
__unsafe_unretained AEIOAudioUnit * THIS = (__bridge AEIOAudioUnit *)inRefCon;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// AERealtimeSafetyMonitor-arm64.c
// AERealtimeWatchdog-arm64.c
// TheAmazingAudioEngine
//
// Created by Michael Tyson on 12/06/2016.
Expand Down Expand Up @@ -43,8 +43,8 @@
* limitations under the License.
*/

#include "AERealtimeSafetyMonitor.h"
#if __arm64__ && REALTIME_SAFETY_MONITOR_ENABLED
#include "AERealtimeWatchdog.h"
#if __arm64__ && REALTIME_WATCHDOG_ENABLED

#include <arm/arch.h>

Expand All @@ -69,7 +69,7 @@ _objc_msgSend:
str x8, [sp, #(8*16+8*8)]

// Look up the real objc_msgSend
bl _AERealtimeSafetyMonitorLookupMsgSendAndWarn
bl _AERealtimeWatchdogLookupMsgSendAndWarn

// imp in x0
mov x17, x0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// AERealtimeSafetyMonitor-simulator-x86_64.s
// AERealtimeWatchdog-simulator-x86_64.s
// TheAmazingAudioEngine
//
// Created by Michael Tyson on 12/06/2016.
Expand Down Expand Up @@ -45,8 +45,8 @@


#include <TargetConditionals.h>
#include "AERealtimeSafetyMonitor.h"
#if __x86_64__ && TARGET_IPHONE_SIMULATOR && REALTIME_SAFETY_MONITOR_ENABLED
#include "AERealtimeWatchdog.h"
#if __x86_64__ && TARGET_IPHONE_SIMULATOR && REALTIME_WATCHDOG_ENABLED


/********************************************************************
Expand Down Expand Up @@ -170,7 +170,7 @@ _objc_msgSend:
SaveRegisters

// Look up the real objc_msgSend
call _AERealtimeSafetyMonitorLookupMsgSendAndWarn
call _AERealtimeWatchdogLookupMsgSendAndWarn

// imp is now in %rax
movq %rax, %r11
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// AERealtimeSafetyMonitor.h
// AERealtimeWatchdog.h
// TheAmazingAudioEngine
//
// Created by Michael Tyson on 12/06/2016.
Expand All @@ -26,8 +26,8 @@
//

#ifdef DEBUG
// Uncomment the following to enable the realtime safety monitor
// #define REALTIME_SAFETY_MONITOR_ENABLED 1
// Uncomment the following to enable the realtime watchdog
// #define REALTIME_WATCHDOG_ENABLED 1
#endif

#ifdef __OBJC__
Expand All @@ -38,24 +38,12 @@
extern "C" {
#endif

/*!
* Initialize realtime safety monitor
*
* Call this method from the audio thread to initialize the systems that monitor
* for non-realtime-thread-safe activities like Objective-C use and memory allocation.
*
* Safe to call multiple times, as implementation is simply a variable assignment.
*
* @param audioThread The audio thread
*/
void AERealtimeSafetyMonitorInit(pthread_t audioThread);

/*!
* Function called when unsafe activity is noticed on the audio thread
*
* Put a breakpoint here to debug.
*/
void AERealtimeSafetyMonitorUnsafeActivityWarning();
void AERealtimeWatchdogUnsafeActivityWarning();

#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit 6afa17a

Please sign in to comment.