mfreerdp-server: rdpsnd cleanup (successive logons working)

This commit is contained in:
C-o-r-E 2013-01-24 20:03:44 -05:00
parent d9968bae7f
commit eb1534434c
3 changed files with 14 additions and 20 deletions

View File

@ -226,6 +226,7 @@ void mf_peer_context_free(freerdp_peer* client, mfPeerContext* context)
#endif #endif
//#ifdef CHANNEL_RDPSND_SERVER //#ifdef CHANNEL_RDPSND_SERVER
mf_peer_rdpsnd_stop();
if (context->rdpsnd) if (context->rdpsnd)
rdpsnd_server_context_free(context->rdpsnd); rdpsnd_server_context_free(context->rdpsnd);
//#endif //#endif

View File

@ -139,6 +139,14 @@ BOOL mf_peer_rdpsnd_init(mfPeerContext* context)
return TRUE; return TRUE;
} }
BOOL mf_peer_rdpsnd_stop()
{
recorderState.isRunning = false;
AudioQueueStop(recorderState.queue, true);
return TRUE;
}
void mf_peer_rdpsnd_input_callback (void *inUserData, void mf_peer_rdpsnd_input_callback (void *inUserData,
AudioQueueRef inAQ, AudioQueueRef inAQ,
AudioQueueBufferRef inBuffer, AudioQueueBufferRef inBuffer,
@ -156,31 +164,14 @@ void mf_peer_rdpsnd_input_callback (void *inUserD
inNumberPacketDescriptions = inBuffer->mAudioDataByteSize / rState->dataFormat.mBytesPerPacket; inNumberPacketDescriptions = inBuffer->mAudioDataByteSize / rState->dataFormat.mBytesPerPacket;
} }
/*write to disc
status = AudioFileWritePackets(
rState->audioFile,
false,
rState->bufferByteSize,
NULL,
rState->currentPacket,
&inNumberPacketDescriptions,
inBuffer->mAudioData);
if (status == noErr) {
rState->currentPacket += inNumberPacketDescriptions;
}
*/
//rState->snd_context->SendSamples(rState->snd_context, inBuffer->mAudioData, rState->bufferByteSize/4);
rState->snd_context->SendSamples(rState->snd_context, inBuffer->mAudioData, inBuffer->mAudioDataByteSize/4);
if (rState->isRunning == 0) if (rState->isRunning == 0)
{ {
return ; return ;
} }
rState->snd_context->SendSamples(rState->snd_context, inBuffer->mAudioData, inBuffer->mAudioDataByteSize/4);
status = AudioQueueEnqueueBuffer( status = AudioQueueEnqueueBuffer(
rState->queue, rState->queue,
inBuffer, inBuffer,

View File

@ -42,7 +42,6 @@ void mf_peer_rdpsnd_input_callback (void *inUserD
UInt32 inNumberPacketDescriptions, UInt32 inNumberPacketDescriptions,
const AudioStreamPacketDescription *inPacketDescs); const AudioStreamPacketDescription *inPacketDescs);
BOOL mf_peer_rdpsnd_init(mfPeerContext* context);
static const int snd_numBuffers = 3; static const int snd_numBuffers = 3;
struct _AQRecorderState struct _AQRecorderState
@ -60,5 +59,8 @@ struct _AQRecorderState
typedef struct _AQRecorderState AQRecorderState; typedef struct _AQRecorderState AQRecorderState;
BOOL mf_peer_rdpsnd_init(mfPeerContext* context);
BOOL mf_peer_rdpsnd_stop();
#endif /* MF_RDPSND_H */ #endif /* MF_RDPSND_H */