mirror of https://github.com/FreeRDP/FreeRDP
Also specify the timestamp when sending samples
This patch complements the SendSample() callback to take the timestamp as extra argument.
This commit is contained in:
parent
99d531655c
commit
f33f755635
|
@ -356,7 +356,7 @@ static BOOL rdpsnd_server_select_format(RdpsndServerContext* context, int client
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL rdpsnd_server_send_audio_pdu(RdpsndServerContext* context)
|
||||
static BOOL rdpsnd_server_send_audio_pdu(RdpsndServerContext* context, UINT16 wTimestamp)
|
||||
{
|
||||
int size;
|
||||
BYTE* src;
|
||||
|
@ -421,7 +421,7 @@ static BOOL rdpsnd_server_send_audio_pdu(RdpsndServerContext* context)
|
|||
Stream_Write_UINT8(s, 0); /* bPad */
|
||||
Stream_Write_UINT16(s, size + fill_size + 8); /* BodySize */
|
||||
|
||||
Stream_Write_UINT16(s, 0); /* wTimeStamp */
|
||||
Stream_Write_UINT16(s, wTimestamp); /* wTimeStamp */
|
||||
Stream_Write_UINT16(s, context->selected_client_format); /* wFormatNo */
|
||||
Stream_Write_UINT8(s, context->block_no); /* cBlockNo */
|
||||
Stream_Seek(s, 3); /* bPad */
|
||||
|
@ -448,7 +448,7 @@ out:
|
|||
return status;
|
||||
}
|
||||
|
||||
static BOOL rdpsnd_server_send_samples(RdpsndServerContext* context, const void* buf, int nframes)
|
||||
static BOOL rdpsnd_server_send_samples(RdpsndServerContext* context, const void* buf, int nframes, UINT16 wTimestamp)
|
||||
{
|
||||
int cframes;
|
||||
int cframesize;
|
||||
|
@ -469,7 +469,7 @@ static BOOL rdpsnd_server_send_samples(RdpsndServerContext* context, const void*
|
|||
|
||||
if (context->priv->out_pending_frames >= context->priv->out_frames)
|
||||
{
|
||||
if (!rdpsnd_server_send_audio_pdu(context))
|
||||
if (!rdpsnd_server_send_audio_pdu(context, wTimestamp))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ static BOOL rdpsnd_server_close(RdpsndServerContext* context)
|
|||
|
||||
if (context->priv->out_pending_frames > 0)
|
||||
{
|
||||
if (!rdpsnd_server_send_audio_pdu(context))
|
||||
if (!rdpsnd_server_send_audio_pdu(context, 0))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef int (*psRdpsndStop)(RdpsndServerContext* context);
|
|||
|
||||
typedef BOOL (*psRdpsndServerInitialize)(RdpsndServerContext* context);
|
||||
typedef BOOL (*psRdpsndServerSelectFormat)(RdpsndServerContext* context, int client_format_index);
|
||||
typedef BOOL (*psRdpsndServerSendSamples)(RdpsndServerContext* context, const void* buf, int nframes);
|
||||
typedef BOOL (*psRdpsndServerSendSamples)(RdpsndServerContext* context, const void* buf, int nframes, UINT16 wTimestamp);
|
||||
typedef BOOL (*psRdpsndServerConfirmBlock)(RdpsndServerContext* context, BYTE confirmBlockNum, UINT16 wtimestamp);
|
||||
typedef BOOL (*psRdpsndServerSetVolume)(RdpsndServerContext* context, int left, int right);
|
||||
typedef BOOL (*psRdpsndServerClose)(RdpsndServerContext* context);
|
||||
|
|
|
@ -197,7 +197,8 @@ void mf_peer_rdpsnd_input_callback (void *inUserD
|
|||
return ;
|
||||
}
|
||||
|
||||
rState->snd_context->SendSamples(rState->snd_context, inBuffer->mAudioData, inBuffer->mAudioDataByteSize/4);
|
||||
rState->snd_context->SendSamples(rState->snd_context, inBuffer->mAudioData,
|
||||
inBuffer->mAudioDataByteSize/4, (UINT16)(GetTickCount() & 0xffff));
|
||||
|
||||
status = AudioQueueEnqueueBuffer(
|
||||
rState->queue,
|
||||
|
|
|
@ -162,8 +162,8 @@ DWORD WINAPI wf_rdpsnd_directsound_thread(LPVOID lpParam)
|
|||
|
||||
//FIXME: frames = bytes/(bytespersample * channels)
|
||||
|
||||
context->rdpsnd->SendSamples(context->rdpsnd, pbCaptureData, dwCaptureLength/4);
|
||||
context->rdpsnd->SendSamples(context->rdpsnd, pbCaptureData2, dwCaptureLength2/4);
|
||||
context->rdpsnd->SendSamples(context->rdpsnd, pbCaptureData, dwCaptureLength/4, (UINT16)(beg & 0xffff));
|
||||
context->rdpsnd->SendSamples(context->rdpsnd, pbCaptureData2, dwCaptureLength2/4, (UINT16)(beg & 0xffff));
|
||||
|
||||
|
||||
hr = capBuf->lpVtbl->Unlock(capBuf, pbCaptureData, dwCaptureLength, pbCaptureData2, dwCaptureLength2);
|
||||
|
|
|
@ -271,7 +271,7 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
|
|||
//Here we are writing the audio data
|
||||
//not sure if this flag is ever set by the system; msdn is not clear about it
|
||||
if (!(flags & AUDCLNT_BUFFERFLAGS_SILENT))
|
||||
context->rdpsnd->SendSamples(context->rdpsnd, pData, packetLength);
|
||||
context->rdpsnd->SendSamples(context->rdpsnd, pData, packetLength, (UINT16)(GetTickCount() & 0xffff));
|
||||
|
||||
hr = pCaptureClient->lpVtbl->ReleaseBuffer(pCaptureClient, numFramesAvailable);
|
||||
if (FAILED(hr))
|
||||
|
@ -313,4 +313,4 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
|
|||
CoUninitialize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue