After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 756948 - directsoundsrc - Audio Device not found on Windows (string encoding not honored)
directsoundsrc - Audio Device not found on Windows (string encoding not honored)
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.6.0
Other Windows
: Normal normal
: 1.8.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-10-22 07:42 UTC by Zack Snyder
Modified: 2016-05-04 07:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
directsoundsrc: Convert Windows strings to UTF8 before comparing against UTF8 strings (1.96 KB, patch)
2016-05-02 08:32 UTC, Sebastian Dröge (slomo)
none Details | Review
directsoundsrc: Convert Windows strings to UTF8 before comparing against UTF8 strings (2.05 KB, patch)
2016-05-03 13:56 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Zack Snyder 2015-10-22 07:42:04 UTC
The 'device-name' property for audio device selection does not honor the encoding.
The pipeline string is in utf8 and the device name from windows is in the local code page encoded. So before comparing, we need to convert the device-name to local 8 bit stringliteral.

The bug was introduced here:
https://bugzilla.gnome.org/show_bug.cgi?id=706574

Problematic code section:

```cpp
if (pGUID && dsoundsrc && dsoundsrc->device_name &&
      !g_strcmp0 (dsoundsrc->device_name, strDesc))
```
Comment 1 Sebastian Dröge (slomo) 2015-10-22 07:52:56 UTC
Can you confirm that using g_locale_from_utf8() fixes it?
Comment 2 Tim-Philipp Müller 2015-10-27 13:43:18 UTC
Zack? Did you have a chance to try if that fixes it?
Comment 3 Sebastian Dröge (slomo) 2016-05-02 08:32:01 UTC
Created attachment 327134 [details] [review]
directsoundsrc: Convert Windows strings to UTF8 before comparing against UTF8 strings

The device name and descriptions returned are in the locale encoding, not
UTF8. Our device name property is in UTF8 though, so we need to convert.
Comment 4 Sebastian Dröge (slomo) 2016-05-03 13:49:28 UTC
Review of attachment 327134 [details] [review]:

::: sys/directsound/gstdirectsoundsrc.c
@@ +353,2 @@
   if (pGUID && dsoundsrc && dsoundsrc->device_name &&
       !g_strcmp0 (dsoundsrc->device_name, strDesc)) {

This should use description instead of strDesc, but g_locale_to_utf8() is failing here anyway so there must be something else going on here.
Comment 5 Sebastian Dröge (slomo) 2016-05-03 13:56:19 UTC
Created attachment 327225 [details] [review]
directsoundsrc: Convert Windows strings to UTF8 before comparing against UTF8 strings

The device name and descriptions returned are in the locale encoding, not
UTF8. Our device name property is in UTF8 though, so we need to convert.
Comment 6 Sebastian Dröge (slomo) 2016-05-03 13:59:48 UTC
Attachment 327225 [details] pushed as 65398a1 - directsoundsrc: Convert Windows strings to UTF8 before comparing against UTF8 strings