sox-devel@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
* sox src/coreaudio device name truncation fix
@ 2016-06-14 18:36 gqrxzy8974
  2016-06-15  7:22 ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: gqrxzy8974 @ 2016-06-14 18:36 UTC (permalink / raw)
  To: SoX-devel

I haven't tested this but it appears the code:

https://sourceforge.net/p/sox/code/ci/master/tree/src/coreaudio.c#l154
                  char name[256];
                  status = AudioDeviceGetProperty(devices[i],0,false,kAudioDevicePropertyDeviceName,&property_size,&name);

Needs to have
                  property_size = sizeof(name);
added before the  AudioDeviceGetProperty call.

Otherwise  property_size has the left over length from the previous request for the list of devices.  I'm seeing
returned names truncated to 11 characters which is 12 including the \0 which matches the
3 device id's (at 4 bytes each) returned by the previous use of property_size.

-- 
http://www.fastmail.com - Does exactly what it says on the tin


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sox src/coreaudio device name truncation fix
  2016-06-14 18:36 sox src/coreaudio device name truncation fix gqrxzy8974
@ 2016-06-15  7:22 ` Eric Wong
  2016-06-15 14:09   ` gqrxzy8974
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2016-06-15  7:22 UTC (permalink / raw)
  To: sox-devel

gqrxzy8974@ftml.net wrote:
> I haven't tested this but it appears the code:
> 
> https://sourceforge.net/p/sox/code/ci/master/tree/src/coreaudio.c#l154
>                   char name[256];
>                   status = AudioDeviceGetProperty(devices[i],0,false,kAudioDevicePropertyDeviceName,&property_size,&name);
> 
> Needs to have
>                   property_size = sizeof(name);
> added before the  AudioDeviceGetProperty call.
> 
> Otherwise  property_size has the left over length from the previous request for the list of devices.  I'm seeing
> returned names truncated to 11 characters which is 12 including the \0 which matches the
> 3 device id's (at 4 bytes each) returned by the previous use of property_size.

Seems reasonable.  Can you test this?
(or provide at least provide a documentation reference).

If not, is there someone else here who can?

Thanks.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sox src/coreaudio device name truncation fix
  2016-06-15  7:22 ` Eric Wong
@ 2016-06-15 14:09   ` gqrxzy8974
  2016-06-16  2:50     ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: gqrxzy8974 @ 2016-06-15 14:09 UTC (permalink / raw)
  To: sox-devel

> Seems reasonable.  Can you test this?
> (or provide at least provide a documentation reference).

The  AudioDeviceGetProperty function is documented in the
CoreAudio header file AudioHardwareDeprecated.h and it is
very clear that property_size needs to be the size of the
receiving area on the call and gets set to the length of the
data returned by the call.

 @function       AudioDeviceGetProperty
    @abstract       Queries an the AudioDevice object to get the data of
    the given property and
                    places it in the provided buffer.
    @discussion     Note that the same functionality is provided by the
    function
                    AudioObjectGetPropertyData().
    @param          inDevice
                        The AudioDevice to query.
    @param          inChannel
                        The channel of the property to query where 0 is
                        the master channel.
    @param          isInput
                        Which section of the AudioDevice to query.
    @param          inPropertyID
                        The AudioDevicePropertyID of the property to
                        query.
    @param          ioPropertyDataSize
                        A UInt32 which on entry indicates the size of
                        the buffer pointed to by
                        outData and on exit indicates how much of the
                        buffer was used.
    @param          outPropertyData
                        The buffer into which the object will put the
                        data for the given property.
    @result         An OSStatus indicating success or failure.
*/
extern OSStatus
AudioDeviceGetProperty( AudioDeviceID           inDevice,
                        UInt32                  inChannel,
                        Boolean                 isInput,
                        AudioDevicePropertyID   inPropertyID,
                        UInt32*                 ioPropertyDataSize,
                        void*                   outPropertyData)         

PS: Changing from using the deprecated CoreAudio interfaces would be a
larger change...

-- 
http://www.fastmail.com - Same, same, but different...


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sox src/coreaudio device name truncation fix
  2016-06-15 14:09   ` gqrxzy8974
@ 2016-06-16  2:50     ` Eric Wong
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2016-06-16  2:50 UTC (permalink / raw)
  To: sox-devel

gqrxzy8974@ftml.net wrote:

<snip>

Thanks.  Pushed to the "pu" (potential updates) branch of
git://80x24.org/sox

https://80x24.org/sox.git/patch?id=bf2afa54a7dec

> PS: Changing from using the deprecated CoreAudio interfaces would be a
> larger change...

Mans and I are just keeping the lights on until Chris and
the others return, and I only use GNU/Linux.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-16  2:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-14 18:36 sox src/coreaudio device name truncation fix gqrxzy8974
2016-06-15  7:22 ` Eric Wong
2016-06-15 14:09   ` gqrxzy8974
2016-06-16  2:50     ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).