winegstreamer: Implement WMA decoder Process(Input|Output) error checks.
Checking that WMA decoder ignores any incorrectly sized input sample. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391 Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d942281a00
commit
6834fc5c9d
|
@ -6035,6 +6035,7 @@ static void test_wma_decoder(void)
|
||||||
MFT_REGISTER_TYPE_INFO input_type = {MFMediaType_Audio, MFAudioFormat_WMAudioV8};
|
MFT_REGISTER_TYPE_INFO input_type = {MFMediaType_Audio, MFAudioFormat_WMAudioV8};
|
||||||
MFT_REGISTER_TYPE_INFO output_type = {MFMediaType_Audio, MFAudioFormat_Float};
|
MFT_REGISTER_TYPE_INFO output_type = {MFMediaType_Audio, MFAudioFormat_Float};
|
||||||
MFT_OUTPUT_STREAM_INFO output_info;
|
MFT_OUTPUT_STREAM_INFO output_info;
|
||||||
|
MFT_OUTPUT_DATA_BUFFER outputs[2];
|
||||||
MFT_INPUT_STREAM_INFO input_info;
|
MFT_INPUT_STREAM_INFO input_info;
|
||||||
MFT_OUTPUT_DATA_BUFFER output;
|
MFT_OUTPUT_DATA_BUFFER output;
|
||||||
const BYTE *wma_encoded_data;
|
const BYTE *wma_encoded_data;
|
||||||
|
@ -6212,7 +6213,7 @@ static void test_wma_decoder(void)
|
||||||
ok(hr == S_OK, "ProcessInput returned %#lx\n", hr);
|
ok(hr == S_OK, "ProcessInput returned %#lx\n", hr);
|
||||||
ret = IMFSample_Release(sample);
|
ret = IMFSample_Release(sample);
|
||||||
ok(ret == 0, "Release returned %lu\n", ret);
|
ok(ret == 0, "Release returned %lu\n", ret);
|
||||||
sample = create_sample(wma_encoded_data + wma_block_size, wma_block_size - wma_block_size / 2);
|
sample = create_sample(wma_encoded_data, wma_block_size + 1);
|
||||||
hr = IMFTransform_ProcessInput(transform, 0, sample, 0);
|
hr = IMFTransform_ProcessInput(transform, 0, sample, 0);
|
||||||
todo_wine
|
todo_wine
|
||||||
ok(hr == S_OK, "ProcessInput returned %#lx\n", hr);
|
ok(hr == S_OK, "ProcessInput returned %#lx\n", hr);
|
||||||
|
@ -6235,16 +6236,13 @@ static void test_wma_decoder(void)
|
||||||
status = 0xdeadbeef;
|
status = 0xdeadbeef;
|
||||||
memset(&output, 0, sizeof(output));
|
memset(&output, 0, sizeof(output));
|
||||||
hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status);
|
hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status);
|
||||||
todo_wine
|
|
||||||
ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#lx\n", hr);
|
ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#lx\n", hr);
|
||||||
ok(output.dwStreamID == 0, "got dwStreamID %lu\n", output.dwStreamID);
|
ok(output.dwStreamID == 0, "got dwStreamID %lu\n", output.dwStreamID);
|
||||||
ok(!output.pSample, "got pSample %p\n", output.pSample);
|
ok(!output.pSample, "got pSample %p\n", output.pSample);
|
||||||
todo_wine
|
|
||||||
ok(output.dwStatus == MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE ||
|
ok(output.dwStatus == MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE ||
|
||||||
broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE)) /* Win7 */,
|
broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE)) /* Win7 */,
|
||||||
"got dwStatus %#lx\n", output.dwStatus);
|
"got dwStatus %#lx\n", output.dwStatus);
|
||||||
ok(!output.pEvents, "got pEvents %p\n", output.pEvents);
|
ok(!output.pEvents, "got pEvents %p\n", output.pEvents);
|
||||||
todo_wine
|
|
||||||
ok(status == 0, "got status %#lx\n", status);
|
ok(status == 0, "got status %#lx\n", status);
|
||||||
|
|
||||||
sample = create_sample(wma_encoded_data, wma_block_size);
|
sample = create_sample(wma_encoded_data, wma_block_size);
|
||||||
|
@ -6257,16 +6255,25 @@ static void test_wma_decoder(void)
|
||||||
status = 0xdeadbeef;
|
status = 0xdeadbeef;
|
||||||
memset(&output, 0, sizeof(output));
|
memset(&output, 0, sizeof(output));
|
||||||
hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status);
|
hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status);
|
||||||
todo_wine
|
|
||||||
ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#lx\n", hr);
|
ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#lx\n", hr);
|
||||||
ok(!output.pSample, "got pSample %p\n", output.pSample);
|
ok(!output.pSample, "got pSample %p\n", output.pSample);
|
||||||
todo_wine
|
|
||||||
ok(output.dwStatus == MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE ||
|
ok(output.dwStatus == MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE ||
|
||||||
broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE)) /* Win7 */,
|
broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE)) /* Win7 */,
|
||||||
"got dwStatus %#lx\n", output.dwStatus);
|
"got dwStatus %#lx\n", output.dwStatus);
|
||||||
todo_wine
|
|
||||||
ok(status == 0, "got status %#lx\n", status);
|
ok(status == 0, "got status %#lx\n", status);
|
||||||
|
|
||||||
|
status = 0xdeadbeef;
|
||||||
|
memset(&output, 0, sizeof(output));
|
||||||
|
output_info.cbSize = sizeof(wma_decoded_data);
|
||||||
|
sample = create_sample(NULL, output_info.cbSize);
|
||||||
|
outputs[0].pSample = sample;
|
||||||
|
sample = create_sample(NULL, output_info.cbSize);
|
||||||
|
outputs[1].pSample = sample;
|
||||||
|
hr = IMFTransform_ProcessOutput(transform, 0, 2, outputs, &status);
|
||||||
|
ok(hr == E_INVALIDARG, "ProcessOutput returned %#lx\n", hr);
|
||||||
|
IMFSample_Release(outputs[0].pSample);
|
||||||
|
IMFSample_Release(outputs[1].pSample);
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
status = 0xdeadbeef;
|
status = 0xdeadbeef;
|
||||||
output_info.cbSize = sizeof(wma_decoded_data);
|
output_info.cbSize = sizeof(wma_decoded_data);
|
||||||
|
@ -6337,7 +6344,6 @@ static void test_wma_decoder(void)
|
||||||
ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#lx\n", hr);
|
ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#lx\n", hr);
|
||||||
ok(output.pSample == sample, "got pSample %p\n", output.pSample);
|
ok(output.pSample == sample, "got pSample %p\n", output.pSample);
|
||||||
ok(output.dwStatus == 0, "got dwStatus %#lx\n", output.dwStatus);
|
ok(output.dwStatus == 0, "got dwStatus %#lx\n", output.dwStatus);
|
||||||
todo_wine
|
|
||||||
ok(status == 0, "got status %#lx\n", status);
|
ok(status == 0, "got status %#lx\n", status);
|
||||||
ret = IMFSample_Release(sample);
|
ret = IMFSample_Release(sample);
|
||||||
ok(ret == 0, "Release returned %lu\n", ret);
|
ok(ret == 0, "Release returned %lu\n", ret);
|
||||||
|
@ -6353,7 +6359,6 @@ static void test_wma_decoder(void)
|
||||||
ok(output.dwStatus == 0 ||
|
ok(output.dwStatus == 0 ||
|
||||||
broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|7)) /* Win7 */,
|
broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|7)) /* Win7 */,
|
||||||
"got dwStatus %#lx\n", output.dwStatus);
|
"got dwStatus %#lx\n", output.dwStatus);
|
||||||
todo_wine
|
|
||||||
ok(status == 0, "got status %#lx\n", status);
|
ok(status == 0, "got status %#lx\n", status);
|
||||||
check_sample(sample, NULL, 0, NULL);
|
check_sample(sample, NULL, 0, NULL);
|
||||||
ret = IMFSample_Release(sample);
|
ret = IMFSample_Release(sample);
|
||||||
|
|
|
@ -520,14 +520,47 @@ static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_
|
||||||
|
|
||||||
static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags)
|
static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags)
|
||||||
{
|
{
|
||||||
|
struct wma_decoder *decoder = impl_from_IMFTransform(iface);
|
||||||
|
MFT_INPUT_STREAM_INFO info;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
FIXME("iface %p, id %lu, sample %p, flags %#lx stub!\n", iface, id, sample, flags);
|
FIXME("iface %p, id %lu, sample %p, flags %#lx stub!\n", iface, id, sample, flags);
|
||||||
|
|
||||||
|
if (!decoder->wg_transform)
|
||||||
|
return MF_E_TRANSFORM_TYPE_NOT_SET;
|
||||||
|
|
||||||
|
if (FAILED(hr = IMFTransform_GetInputStreamInfo(iface, 0, &info)))
|
||||||
|
return hr;
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count,
|
static HRESULT WINAPI transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count,
|
||||||
MFT_OUTPUT_DATA_BUFFER *samples, DWORD *status)
|
MFT_OUTPUT_DATA_BUFFER *samples, DWORD *status)
|
||||||
{
|
{
|
||||||
|
struct wma_decoder *decoder = impl_from_IMFTransform(iface);
|
||||||
|
MFT_OUTPUT_STREAM_INFO info;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
FIXME("iface %p, flags %#lx, count %lu, samples %p, status %p stub!\n", iface, flags, count, samples, status);
|
FIXME("iface %p, flags %#lx, count %lu, samples %p, status %p stub!\n", iface, flags, count, samples, status);
|
||||||
|
|
||||||
|
if (count > 1)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
if (!decoder->wg_transform)
|
||||||
|
return MF_E_TRANSFORM_TYPE_NOT_SET;
|
||||||
|
|
||||||
|
if (FAILED(hr = IMFTransform_GetOutputStreamInfo(iface, 0, &info)))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
*status = 0;
|
||||||
|
samples[0].dwStatus = 0;
|
||||||
|
if (!samples[0].pSample)
|
||||||
|
{
|
||||||
|
samples[0].dwStatus = MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE;
|
||||||
|
return MF_E_TRANSFORM_NEED_MORE_INPUT;
|
||||||
|
}
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue