[PATCH] msgsm32.acm: msgsm32 should not perform PCM-to-PCM conversion.

Hiroki Awata castaneai at by.black
Sat Aug 14 09:56:14 CDT 2021


If the source and destination are both in a specific PCM format (1 channel, 16bit), acmStreamOpen will select the GSM 6.10 driver in preference to the built-in, causing incorrect conversion.

Signed-off-by: Hiroki Awata <castaneai at by.black>
---
 dlls/msacm32/tests/msacm.c | 1 +
 dlls/msgsm32.acm/msgsm32.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/dlls/msacm32/tests/msacm.c b/dlls/msacm32/tests/msacm.c
index 04b4e090820..82ddb430cd7 100644
--- a/dlls/msacm32/tests/msacm.c
+++ b/dlls/msacm32/tests/msacm.c
@@ -1056,6 +1056,7 @@ struct stream_output
 static const struct stream_output expected_output[] = {
     /* #0: Identical conversion */
     {{WAVE_FORMAT_PCM, 1, 8000, 8000, 1, 8}, {WAVE_FORMAT_PCM, 1, 8000, 8000, 1, 8}, {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}, 64, FALSE},
+    {{WAVE_FORMAT_PCM, 1, 44100, 88200, 2, 16}, {WAVE_FORMAT_PCM, 1, 44100, 88200, 2, 16}, {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}, 64, FALSE},
 
     /* #1: 1 -> 2 channels */
     {{WAVE_FORMAT_PCM, 1, 8000, 8000, 1, 8}, {WAVE_FORMAT_PCM, 2, 8000, 16000, 2, 8}, {0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47,48,48,49,49,50,50,51,51,52,52,53,53,54,54,55,55,56,56,57,57,58,58,59,59,60,60,61,61,62,62,63,63}, 128, FALSE},
diff --git a/dlls/msgsm32.acm/msgsm32.c b/dlls/msgsm32.acm/msgsm32.c
index bd54aa4fb36..d1d4c01d0e7 100644
--- a/dlls/msgsm32.acm/msgsm32.c
+++ b/dlls/msgsm32.acm/msgsm32.c
@@ -364,6 +364,9 @@ static	LRESULT	GSM_StreamOpen(PACMDRVSTREAMINSTANCE adsi)
 {
     int used = 1;
     gsm r;
+    if (adsi->pwfxSrc->wFormatTag != WAVE_FORMAT_GSM610 && adsi->pwfxDst->wFormatTag != WAVE_FORMAT_GSM610)
+        return MMSYSERR_NOTSUPPORTED;
+
     if (!GSM_FormatValidate(adsi->pwfxSrc) || !GSM_FormatValidate(adsi->pwfxDst))
         return MMSYSERR_NOTSUPPORTED;
 
-- 
2.27.0




More information about the wine-devel mailing list