Fix issue 129
This commit is contained in:
parent
859e6eed28
commit
edf52d8a92
|
@ -42,6 +42,7 @@ typedef struct tdav_producer_audiounit_s
|
|||
tdav_audiounit_handle_t* audioUnitHandle;
|
||||
unsigned started:1;
|
||||
unsigned paused:1;
|
||||
unsigned muted;
|
||||
void* senderThreadId[1];
|
||||
tsk_condwait_handle_t* senderCondWait;
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ int tdav_audiounit_handle_start(tdav_audiounit_handle_t* self)
|
|||
if(!inst->started && (status = AudioOutputUnitStart(inst->audioUnit))){
|
||||
TSK_DEBUG_ERROR("AudioOutputUnitStart failed with status=%ld", (signed long)status);
|
||||
}
|
||||
inst->started = status == 0 ? tsk_true : tsk_false;
|
||||
inst->started = (status == noErr) ? tsk_true : tsk_false;
|
||||
tsk_safeobj_unlock(inst);
|
||||
return status ? -2 : 0;
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ int tdav_audiounit_handle_mute(tdav_audiounit_handle_t* self, tsk_bool_t mute)
|
|||
status = AudioUnitSetProperty(inst->audioUnit, kAUVoiceIOProperty_MuteOutput,
|
||||
kAudioUnitScope_Output, kOutputBus, mute ? &kOne : &kZero, mute ? sizeof(kOne) : sizeof(kZero));
|
||||
|
||||
return status ? -2 : 0;
|
||||
return (status == noErr) ? 0 : -2;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
|
|
@ -186,11 +186,12 @@ static void *__sender_thread(void *param)
|
|||
/* ============ Media Producer Interface ================= */
|
||||
int tdav_producer_audiounit_set(tmedia_producer_t* self, const tmedia_param_t* param)
|
||||
{
|
||||
tdav_producer_audiounit_t* producer = (tdav_producer_audiounit_t*)self;
|
||||
if(param->plugin_type == tmedia_ppt_producer){
|
||||
if(param->value_type == tmedia_pvt_int32){
|
||||
if(tsk_striequals(param->key, "mute")){
|
||||
int32_t mute = TSK_TO_INT32((uint8_t*)param->value);
|
||||
return tdav_audiounit_handle_mute(((tdav_producer_audiounit_t*)self)->audioUnitHandle, mute ? tsk_true : tsk_false);
|
||||
producer->muted = TSK_TO_INT32((uint8_t*)param->value);
|
||||
return tdav_audiounit_handle_mute(((tdav_producer_audiounit_t*)self)->audioUnitHandle, producer->muted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -406,6 +407,9 @@ static int tdav_producer_audiounit_start(tmedia_producer_t* self)
|
|||
}
|
||||
}
|
||||
producer->started = tsk_true;
|
||||
|
||||
// apply parameters (because could be lost when the producer is restarted -handle recreated-)
|
||||
ret = tdav_audiounit_handle_mute(producer->audioUnitHandle, producer->muted);
|
||||
|
||||
// create conditional variable
|
||||
if(!(producer->senderCondWait = tsk_condwait_create())){
|
||||
|
|
Loading…
Reference in New Issue