mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
winegstreamer: Handle missing or zero channel count in _GetOutputAvailableType in AAC decoder.
This commit is contained in:
parent
3432ef30c3
commit
5b0172e161
2 changed files with 20 additions and 5 deletions
|
@ -2555,6 +2555,22 @@ static void test_aac_decoder_channels(const struct attribute_desc *input_type_de
|
|||
goto failed;
|
||||
}
|
||||
|
||||
hr = MFCreateMediaType(&type);
|
||||
ok(hr == S_OK, "got %#lx.\n", hr);
|
||||
input_desc[num_channels_index].value.vt = VT_UI8;
|
||||
input_desc[num_channels_index].value.ulVal = 1;
|
||||
init_media_type(type, input_desc, -1);
|
||||
hr = IMFTransform_SetInputType(transform, 0, type, 0);
|
||||
ok(hr == S_OK, "got %#lx.\n", hr);
|
||||
IMFMediaType_Release(type);
|
||||
hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &type);
|
||||
ok(hr == S_OK, "got %#lx.\n", hr);
|
||||
hr = IMFAttributes_GetUINT32((IMFAttributes *)type, &MF_MT_AUDIO_NUM_CHANNELS, &value);
|
||||
ok(hr == S_OK, "got %#lx.\n", hr);
|
||||
ok(value == 2, "got %u.\n", value);
|
||||
IMFMediaType_Release(type);
|
||||
input_desc[num_channels_index].value.vt = VT_UI4;
|
||||
|
||||
for (num_channels = 0; num_channels < 16; ++num_channels)
|
||||
{
|
||||
many_channels = num_channels > 2;
|
||||
|
@ -2592,18 +2608,15 @@ static void test_aac_decoder_channels(const struct attribute_desc *input_type_de
|
|||
expected_chans = 2;
|
||||
else
|
||||
expected_chans = num_channels;
|
||||
todo_wine_if(!num_channels)
|
||||
ok(value == expected_chans, "got %u, expected %u.\n", value, expected_chans);
|
||||
|
||||
hr = IMFAttributes_GetUINT32(attrs, &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, &value);
|
||||
ok(hr == S_OK, "got %#lx.\n", hr);
|
||||
todo_wine_if(!num_channels)
|
||||
ok(value == sample_size * 44100 * expected_chans, "got %u, expected %u.\n",
|
||||
value, sample_size * 44100 * expected_chans);
|
||||
|
||||
hr = IMFAttributes_GetUINT32(attrs, &MF_MT_AUDIO_BLOCK_ALIGNMENT, &value);
|
||||
ok(hr == S_OK, "got %#lx.\n", hr);
|
||||
todo_wine_if(!num_channels)
|
||||
ok(value == sample_size * expected_chans, "got %u, expected %u.\n", value, sample_size * expected_chans);
|
||||
|
||||
hr = IMFAttributes_GetUINT32(attrs, &MF_MT_AUDIO_PREFER_WAVEFORMATEX, &value);
|
||||
|
|
|
@ -291,6 +291,10 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR
|
|||
|
||||
*type = NULL;
|
||||
|
||||
if (FAILED(hr = IMFMediaType_GetUINT32(decoder->input_type, &MF_MT_AUDIO_NUM_CHANNELS, &channel_count))
|
||||
|| !channel_count)
|
||||
channel_count = 2;
|
||||
|
||||
if (index >= ARRAY_SIZE(aac_decoder_output_types))
|
||||
return MF_E_NO_MORE_TYPES;
|
||||
index = ARRAY_SIZE(aac_decoder_output_types) - index - 1;
|
||||
|
@ -318,8 +322,6 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR
|
|||
if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_BITS_PER_SAMPLE, sample_size)))
|
||||
goto done;
|
||||
|
||||
if (FAILED(hr = IMFMediaType_GetUINT32(decoder->input_type, &MF_MT_AUDIO_NUM_CHANNELS, &channel_count)))
|
||||
goto done;
|
||||
if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_NUM_CHANNELS, channel_count)))
|
||||
goto done;
|
||||
|
||||
|
|
Loading…
Reference in a new issue