[mythtv-commits] Ticket #10484: Proposed pulseaudio latency calculation fixes (fixes warning for unsigned int value)

MythTV noreply at mythtv.org
Tue Mar 20 21:40:36 UTC 2012


#10484: Proposed pulseaudio latency calculation fixes (fixes warning for unsigned
int value)
-------------------------------------------------+-------------------------
 Reporter:  Gary Buhrmaster <gary.buhrmaster@…>  |           Type:  Patch -
   Status:  new                                  |  Bug Fix
Milestone:  unknown                              |       Priority:  minor
  Version:  Unspecified                          |      Component:  MythTV
 Keywords:                                       |  - General
                                                 |       Severity:  medium
                                                 |  Ticket locked:  0
-------------------------------------------------+-------------------------
 In audiooutputpulse.cpp, clang reports a warning (comparison of unsigned
 expression < 0 is always false) for the following code fragment:

    if (latency < 0)

 latency is defined as:

   pa_usec_t latency = (pa_usec_t) -1;

 which, since pa_usec_t is an unsigned variable, actually sets latency to
 be the max value, and as the warning indicates, as an unsigned variable
 the comparison will always be false.

 I am not at all familiar with the PulseAudio API, but it seems that one
 should check for the value being returned from get_latency being negative
 via the negative return int, and act accordingly if one wants to change a
 negative value to zero.

 I think that it is possible with the current code for a latency value
 which should be interpreted as negative to be interpreted as positive,
 resulting in some confusion elsewhere.

 I have provided a proposed patch, but the SME for this code needs to
 review it carefully to insure the patch would be an improvement.  Since I
 do not currently use PulseAudio, I am not sure when I could test these
 changes.

 Thanks.

 Gary

-- 
Ticket URL: <http://code.mythtv.org/trac/ticket/10484>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center


More information about the mythtv-commits mailing list