Bug 11074 - Failed to get buffer attributes error when playing sounds
Summary: Failed to get buffer attributes error when playing sounds
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 6.3.x
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-03-12 11:53 UTC by mdev
Modified: 2017-01-30 19:54 UTC (History)
5 users (show)

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


Attachments
Console logs. (3.66 KB, text/plain)
2014-05-05 17:08 UTC, A.Timofeev
Details


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:
Status:
RESOLVED FIXED

Description mdev 2013-03-12 11:53:06 UTC
Using monogame, when play sounds on iOS device, randomly some sounds dont play and print "Failed to get buffer attributes" to the console debug output. Playing on the simulator generally has no problems, tho i may have seen it once or twice, but nearly as prevalent as on an iOS device.

This thread on github goes into greater detail.
https://github.com/mono/MonoGame/issues/1123
Comment 2 PJ 2013-07-11 17:52:24 UTC
mdev: We're probably not going to get to this for 6.4, unfortunately - do you have any further logs or a reproducible test case (full project)? Device logs from Xcode would likely be very useful here.
Comment 3 PJ 2013-11-19 16:44:39 UTC
This bug was targeted for a past milestone, moving to the next non-hotfix active milestone.
Comment 4 A.Timofeev 2014-05-05 17:08:29 UTC
Created attachment 6734 [details]
Console logs.
Comment 5 A.Timofeev 2014-05-05 17:08:43 UTC
Here is the test code snippet. Subsequent calls to AudioFileStream.ParseBytes, AudioFileStream.DataFormat with the same audio data in a for loop produce different results.
AudioStreamBasicDescription's properties: BytesPerPacket, BytesPerFrame, ChannelsPerFrame sometimes are negative or zero.

    byte[] audiodata = ... // WAV
    const int numAttempts = 500000;
    int numFails = 0;
    for (int i = 0; i < numAttempts; ++i)
    {
        using (AudioFileStream afs = new AudioFileStream (AudioFileType.WAVE))
        {
            afs.ParseBytes (audiodata, false);
            AudioStreamBasicDescription asbd = afs.DataFormat;
            if (asbd.ChannelsPerFrame <= 0)
            {
                ++numFails;
                Trace.WriteLine(string.Format("attempt {0}, bad asbd={1}", i, asbd));
            }
        }
    }
    Trace.WriteLine(string.Format("fails/attempts = {0}/{1}", numFails, numAttempts));

Test for file 1:
> fails/attempts = 45/500000
Failed attempts gave zero values: BytesPerPacket=0, BytesPerFrame=0, ChannelsPerFrame=0.

Test for file 2:
> fails/attempts = 683/500000
Failed attempts gave negative values: BytesPerPacket=-2 BytesPerFrame=-2 ChannelsPerFrame=-1.
Comment 6 PJ 2014-05-05 17:10:23 UTC
Thanks for the info! Updating some of the metadata.
Comment 7 Vincent Dondain [MSFT] 2017-01-30 19:54:21 UTC
Hi,

I cannot reproduce the issue anymore. I created a small sample with precisely the above code snippet: https://www.dropbox.com/s/87ciper14c2urhc/Bug11074.zip?dl=0

Always getting: fails/attempts = 0/500000

Also it seems workarounds have been found in: https://github.com/mono/MonoGame/issues/1123

In addition to that we now have a proper sample testing and using AudioFileStream extensively.

I'm closing this bug as I believe it's been solved.

If you are still experiencing this issue please re-open the bug report. Thanks!