Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#7874 closed defect (fixed)

nvidia refresh rate detection uses locale-aware strtod() function

Reported by: René H. Larsen <rhl@…> Owned by: Janne Grunau
Priority: minor Milestone: 0.23
Component: MythTV - Video Playback Version: 0.22-fixes
Severity: low Keywords:
Cc: Ticket locked: no

Description

I'm using MythTV 0.22-fixes with VDPAU on a GT 220 GPU connected via HDMI to a Samsung UE46B7070 TV.

I've noticed that MythTV reports inaccurate refresh rates for the modes supported by my TV. For instance, the refresh rate of the 1920x1080_50 mode is reported as 49.832Hz. This causes MythTV to choose the wrong display mode in some cases (eg. 720p50 material displayed at 60Hz).

I've tracked down the problem to the use of strtod() for parsing the dcl value of the modeline in libmythui/util-nvctrl.cpp.

I'm in a part of the world (Denmark) that uses "," as the decimal point, while the modeline reported by the nvidia driver uses ".". The locale-aware strtod() function mis-parses the value, effectively rounding it down to the nearest integer.

My solution is to use a C++ stringstream imbued with the "C" locale for parsing that part of the modeline. See the attached patch.

I believe this fix may make 23023 redundant.

A workaround for those affected, who don't want to recompile MythTV, is to set LC_NUMERIC=C when starting the frontend, thus overriding the default locale with respect to parsing and displaying numeric values:

LC_NUMERIC=C mythfrontend

Attachments (1)

util-nvctrl-refresh-rate-fix.patch (1.0 KB) - added by René H. Larsen <rhl@…> 10 years ago.
Fix nvidia refresh rate detection for some non-english locales

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by René H. Larsen <rhl@…>

Fix nvidia refresh rate detection for some non-english locales

comment:1 Changed 10 years ago by Stuart Auchterlonie

Milestone: unknown0.23
Owner: changed from Janne Grunau to markk
Status: newassigned

comment:2 Changed 10 years ago by markk

Owner: changed from markk to jya

comment:3 Changed 9 years ago by Janne Grunau

Owner: changed from jya to Janne Grunau
Status: assignedaccepted

comment:4 Changed 9 years ago by Janne Grunau

Resolution: fixed
Status: acceptedclosed

(In [23831]) Fix nvidia refresh rate detection for some non-english locales

Replace locale decendent strtod with C++ inputstream. Fixes #7874 Patch by: René H. Larsen < rhl izzlazz dk >

comment:5 Changed 9 years ago by Janne Grunau

(In [23833]) Backports [23831] from trunk

Fix nvidia refresh rate detection for some non-english locales Replace locale decendent strtod with C++ inputstream. Refs #7874 Patch by: René H. Larsen < rhl izzlazz dk >

Note: See TracTickets for help on using tickets.