Bug 2685 - AudioFile::WritePackets does not allow writing packets without descriptors
Summary: AudioFile::WritePackets does not allow writing packets without descriptors
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.0
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2011-12-29 10:00 UTC by Jackson Harper
Modified: 2012-01-12 19:12 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Jackson Harper 2011-12-29 10:00:24 UTC
The AudioFile::WritePackets calculates the length of the packets to write using the length of the AudioStreamPacketDescription array, but this is incorrect. Its possible to pass AudioFileWritePackets NULL for inPacketDescriptions but still have valid packet data - this is the norm when generating audio.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-01-02 20:11:13 UTC
From a quick look it doesn't look like it's possible to calculate the packet size (and the number of packets), so a new overload would be required:

public int WritePackets (bool useCache, long inStartingPacket, int numPackets, IntPtr buffer, int count)

does that sound like it would solve your problem?
Comment 2 Jackson Harper 2012-01-02 20:15:35 UTC
The ideal would probably be the new overload and obsoleting the old one which isn't a very common usage IMO.  It might be a good time to fix the error results too. I think it would be easier if it just returned the error rather than the length (like the iOS functions).

Up to you guys though, I'm p/invoking it myself now, so I don't really care.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2012-01-12 19:12:22 UTC
Fixed, will be included in 5.1.3.

I just added the a new overload.