mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-18 06:20:21 +00:00
Created logger with log levels
This commit is contained in:
@@ -111,7 +111,7 @@ void ArInit(void)
|
||||
status = AudioComponentInstanceNew(AudioComponentFindNext(NULL, &audioDesc), &audioUnit);
|
||||
|
||||
if (status) {
|
||||
NSLog(@"Unable to instantiate new AudioComponent: %d", (int32_t)status);
|
||||
Log(LOG_E, @"Unable to instantiate new AudioComponent: %d", (int32_t)status);
|
||||
}
|
||||
|
||||
AudioStreamBasicDescription audioFormat = {0};
|
||||
@@ -132,7 +132,7 @@ void ArInit(void)
|
||||
&audioFormat,
|
||||
sizeof(audioFormat));
|
||||
if (status) {
|
||||
NSLog(@"Unable to set audio unit to input: %d", (int32_t)status);
|
||||
Log(LOG_E, @"Unable to set audio unit to input: %d", (int32_t)status);
|
||||
}
|
||||
|
||||
AURenderCallbackStruct callbackStruct = {0};
|
||||
@@ -146,12 +146,12 @@ void ArInit(void)
|
||||
&callbackStruct,
|
||||
sizeof(callbackStruct));
|
||||
if (status) {
|
||||
NSLog(@"Unable to set audio unit callback: %d", (int32_t)status);
|
||||
Log(LOG_E, @"Unable to set audio unit callback: %d", (int32_t)status);
|
||||
}
|
||||
|
||||
status = AudioUnitInitialize(audioUnit);
|
||||
if (status) {
|
||||
NSLog(@"Unable to initialize audioUnit: %d", (int32_t)status);
|
||||
Log(LOG_E, @"Unable to initialize audioUnit: %d", (int32_t)status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ void ArRelease(void)
|
||||
|
||||
OSStatus status = AudioUnitUninitialize(audioUnit);
|
||||
if (status) {
|
||||
NSLog(@"Unable to uninitialize audioUnit: %d", (int32_t)status);
|
||||
Log(LOG_E, @"Unable to uninitialize audioUnit: %d", (int32_t)status);
|
||||
}
|
||||
|
||||
// Audio session is now inactive
|
||||
@@ -186,7 +186,7 @@ void ArStart(void)
|
||||
{
|
||||
OSStatus status = AudioOutputUnitStart(audioUnit);
|
||||
if (status) {
|
||||
NSLog(@"Unable to start audioUnit: %d", (int32_t)status);
|
||||
Log(LOG_E, @"Unable to start audioUnit: %d", (int32_t)status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ void ArStop(void)
|
||||
{
|
||||
OSStatus status = AudioOutputUnitStop(audioUnit);
|
||||
if (status) {
|
||||
NSLog(@"Unable to stop audioUnit: %d", (int32_t)status);
|
||||
Log(LOG_E, @"Unable to stop audioUnit: %d", (int32_t)status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ void ArDecodeAndPlaySample(char* sampleData, int sampleLength)
|
||||
|
||||
[audioLock lock];
|
||||
if (audioBufferQueueLength > MAX_QUEUE_ENTRIES) {
|
||||
NSLog(@"Audio player too slow. Dropping all decoded samples!");
|
||||
Log(LOG_W, @"Audio player too slow. Dropping all decoded samples!");
|
||||
|
||||
// Clear all values from the buffer queue
|
||||
struct AUDIO_BUFFER_QUEUE_ENTRY *entry;
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
y:_config.height / screenSize.height];
|
||||
|
||||
int majorVersion = [[appversion substringToIndex:1] intValue];
|
||||
NSLog(@"Server is generation %d", majorVersion);
|
||||
Log(LOG_I, @"Server is generation %d", majorVersion);
|
||||
|
||||
VideoDecoderRenderer* renderer = [[VideoDecoderRenderer alloc]initWithView:_renderView];
|
||||
_connection = [[Connection alloc] initWithConfig:_config renderer:renderer connectionCallbacks:_callbacks serverMajorVersion:majorVersion];
|
||||
@@ -121,11 +121,11 @@
|
||||
NSString *gameSession = [launchResp getStringTag:@"gamesession"];
|
||||
if (launchResp == NULL || ![launchResp isStatusOk]) {
|
||||
[_callbacks launchFailed:@"Failed to launch app"];
|
||||
NSLog(@"Failed Launch Response: %@", launchResp.statusMessage);
|
||||
Log(LOG_E, @"Failed Launch Response: %@", launchResp.statusMessage);
|
||||
return FALSE;
|
||||
} else if (gameSession == NULL || [gameSession isEqualToString:@"0"]) {
|
||||
[_callbacks launchFailed:launchResp.statusMessage];
|
||||
NSLog(@"Failed to parse game session. Code: %ld Response: %@", (long)launchResp.statusCode, launchResp.statusMessage);
|
||||
Log(LOG_E, @"Failed to parse game session. Code: %ld Response: %@", (long)launchResp.statusCode, launchResp.statusMessage);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -140,11 +140,11 @@
|
||||
NSString* resume = [resumeResp getStringTag:@"resume"];
|
||||
if (resumeResp == NULL || ![resumeResp isStatusOk]) {
|
||||
[_callbacks launchFailed:@"Failed to resume app"];
|
||||
NSLog(@"Failed Resume Response: %@", resumeResp.statusMessage);
|
||||
Log(LOG_E, @"Failed Resume Response: %@", resumeResp.statusMessage);
|
||||
return FALSE;
|
||||
} else if (resume == NULL || [resume isEqualToString:@"0"]) {
|
||||
[_callbacks launchFailed:resumeResp.statusMessage];
|
||||
NSLog(@"Failed to parse resume response. Code: %ld Response: %@", (long)resumeResp.statusCode, resumeResp.statusMessage);
|
||||
Log(LOG_E, @"Failed to parse resume response. Code: %ld Response: %@", (long)resumeResp.statusCode, resumeResp.statusMessage);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
kCFAllocatorDefault,
|
||||
NULL, 0, nalLength + 1, 0);
|
||||
if (status != noErr) {
|
||||
NSLog(@"CMBlockBufferReplaceDataBytes failed: %d", (int)status);
|
||||
Log(LOG_E, @"CMBlockBufferReplaceDataBytes failed: %d", (int)status);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
status = CMBlockBufferReplaceDataBytes(lengthBytes, existingBuffer,
|
||||
oldOffset, NAL_LENGTH_PREFIX_SIZE);
|
||||
if (status != noErr) {
|
||||
NSLog(@"CMBlockBufferReplaceDataBytes failed: %d", (int)status);
|
||||
Log(LOG_E, @"CMBlockBufferReplaceDataBytes failed: %d", (int)status);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -106,7 +106,7 @@
|
||||
kCFAllocatorDefault, NULL, 0,
|
||||
NAL_LENGTH_PREFIX_SIZE, 0);
|
||||
if (status != noErr) {
|
||||
NSLog(@"CMBlockBufferAppendMemoryBlock failed: %d", (int)status);
|
||||
Log(LOG_E, @"CMBlockBufferAppendMemoryBlock failed: %d", (int)status);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
status = CMBlockBufferReplaceDataBytes(lengthBytes, existingBuffer,
|
||||
oldOffset, NAL_LENGTH_PREFIX_SIZE);
|
||||
if (status != noErr) {
|
||||
NSLog(@"CMBlockBufferReplaceDataBytes failed: %d", (int)status);
|
||||
Log(LOG_E, @"CMBlockBufferReplaceDataBytes failed: %d", (int)status);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
kCFAllocatorNull, // Don't deallocate data on free
|
||||
NULL, 0, dataLength, 0);
|
||||
if (status != noErr) {
|
||||
NSLog(@"CMBlockBufferReplaceDataBytes failed: %d", (int)status);
|
||||
Log(LOG_E, @"CMBlockBufferReplaceDataBytes failed: %d", (int)status);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@
|
||||
|
||||
// Check for previous decoder errors before doing anything
|
||||
if (displayLayer.status == AVQueuedSampleBufferRenderingStatusFailed) {
|
||||
NSLog(@"Display layer rendering failed: %@", displayLayer.error);
|
||||
Log(LOG_E, @"Display layer rendering failed: %@", displayLayer.error);
|
||||
|
||||
// Recreate the display layer
|
||||
[self reinitializeDisplayLayer];
|
||||
@@ -152,14 +152,14 @@
|
||||
|
||||
if (nalType == NAL_TYPE_SPS || nalType == NAL_TYPE_PPS) {
|
||||
if (nalType == NAL_TYPE_SPS) {
|
||||
NSLog(@"Got SPS");
|
||||
Log(LOG_I, @"Got SPS");
|
||||
spsData = [NSData dataWithBytes:&data[FRAME_START_PREFIX_SIZE] length:length - FRAME_START_PREFIX_SIZE];
|
||||
waitingForSps = false;
|
||||
|
||||
// We got a new SPS so wait for a new PPS to match it
|
||||
waitingForPps = true;
|
||||
} else if (nalType == NAL_TYPE_PPS) {
|
||||
NSLog(@"Got PPS");
|
||||
Log(LOG_I, @"Got PPS");
|
||||
ppsData = [NSData dataWithBytes:&data[FRAME_START_PREFIX_SIZE] length:length - FRAME_START_PREFIX_SIZE];
|
||||
waitingForPps = false;
|
||||
}
|
||||
@@ -169,7 +169,7 @@
|
||||
const uint8_t* const parameterSetPointers[] = { [spsData bytes], [ppsData bytes] };
|
||||
const size_t parameterSetSizes[] = { [spsData length], [ppsData length] };
|
||||
|
||||
NSLog(@"Constructing new format description");
|
||||
Log(LOG_I, @"Constructing new format description");
|
||||
status = CMVideoFormatDescriptionCreateFromH264ParameterSets(kCFAllocatorDefault,
|
||||
2, /* count of parameter sets */
|
||||
parameterSetPointers,
|
||||
@@ -177,7 +177,7 @@
|
||||
NAL_LENGTH_PREFIX_SIZE,
|
||||
&formatDesc);
|
||||
if (status != noErr) {
|
||||
NSLog(@"Failed to create format description: %d", (int)status);
|
||||
Log(LOG_E, @"Failed to create format description: %d", (int)status);
|
||||
formatDesc = NULL;
|
||||
}
|
||||
}
|
||||
@@ -206,7 +206,7 @@
|
||||
|
||||
status = CMBlockBufferCreateEmpty(NULL, 0, 0, &blockBuffer);
|
||||
if (status != noErr) {
|
||||
NSLog(@"CMBlockBufferCreateEmpty failed: %d", (int)status);
|
||||
Log(LOG_E, @"CMBlockBufferCreateEmpty failed: %d", (int)status);
|
||||
free(data);
|
||||
return DR_NEED_IDR;
|
||||
}
|
||||
@@ -241,7 +241,7 @@
|
||||
NULL, 0, NULL,
|
||||
&sampleBuffer);
|
||||
if (status != noErr) {
|
||||
NSLog(@"CMSampleBufferCreate failed: %d", (int)status);
|
||||
Log(LOG_E, @"CMSampleBufferCreate failed: %d", (int)status);
|
||||
CFRelease(blockBuffer);
|
||||
return DR_NEED_IDR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user