diff --git a/media/libcubeb/src/cubeb_wasapi.cpp b/media/libcubeb/src/cubeb_wasapi.cpp index 632b96af13c1..a2b5633d46f6 100644 --- a/media/libcubeb/src/cubeb_wasapi.cpp +++ b/media/libcubeb/src/cubeb_wasapi.cpp @@ -641,6 +641,7 @@ handle_channel_layout(cubeb_stream * stm, WAVEFORMATEX ** mix_format, const cub } /* Otherwise, the hardware supports more than two channels. */ + WAVEFORMATEX hw_mixformat = **mix_format; /* The docs say that GetMixFormat is always of type WAVEFORMATEXTENSIBLE [1], * so the reinterpret_cast below should be safe. In practice, this is not @@ -688,8 +689,9 @@ handle_channel_layout(cubeb_stream * stm, WAVEFORMATEX ** mix_format, const cub *mix_format = closest; } else if (hr == AUDCLNT_E_UNSUPPORTED_FORMAT) { /* Not supported, no suggestion. This should not happen, but it does in the - * field with some sound cards. We simply bail out and let the rest of the - * code figure out the right conversion path. */ + * field with some sound cards. We restore the mix format, and let the rest + * of the code figure out the right conversion path. */ + **mix_format = hw_mixformat; } else if (hr == S_OK) { LOG("Requested format accepted by WASAPI."); }