Create data copy in case of dynamic sound channel.
(cherry picked from commit f016f1ec09
)
This commit is contained in:
parent
63730ab349
commit
b1c7c9f59d
@ -1445,12 +1445,25 @@ static UINT rdpsnd_on_data_received(IWTSVirtualChannelCallback* pChannelCallback
|
||||
{
|
||||
RDPSND_CHANNEL_CALLBACK* callback = (RDPSND_CHANNEL_CALLBACK*)pChannelCallback;
|
||||
rdpsndPlugin* plugin;
|
||||
wStream* copy;
|
||||
size_t len = Stream_GetRemainingLength(data);
|
||||
|
||||
if (!callback || !callback->plugin)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
plugin = (rdpsndPlugin*)callback->plugin;
|
||||
|
||||
if (!MessageQueue_Post(plugin->queue, NULL, 0, data, NULL))
|
||||
copy = StreamPool_Take(plugin->pool, len);
|
||||
if (!copy)
|
||||
return ERROR_OUTOFMEMORY;
|
||||
Stream_Copy(data, copy, len);
|
||||
Stream_SealLength(copy);
|
||||
Stream_SetPosition(copy, 0);
|
||||
|
||||
if (!MessageQueue_Post(plugin->queue, NULL, 0, copy, NULL))
|
||||
{
|
||||
Stream_Release(copy);
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user