Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

AVAssetWriter / AVAudioPlayer Conflict?

listingboatlistingboat Posts: 55Registered Users
Weeks ago, I posted this thread regarding problems I was having with AVAssetWriter: http://www.iphonedevsdk.com/forum/iphone-sdk-development/81747-avassetwriter-woes.html

Further research seems to lead to a conflict using AVAssetWriter while playing audio with AVAudioPlayer or, really, any audio system. I tried with OpenAL as well.

Here's the background:

- Using AVAssetWriter to write frames to a video from an image or set of images works fine UNTIL [AVAudioPlayer play] is called.

- This only happens on the device, not the sim.

- The error occurs when attempting to create a pixel buffer from CVPixelBufferPoolCreatePixelBuffer.

- Once the audio starts playing, the AVAssetWriterInputPixelBufferAdaptor.pixelBufferPool which existed before suddely becomes nil.

You can download the representative project here: TestAVMethods.zip

Comment out AVAudioPlayer play and it will work on the device.

Any clues are appreciated.
Post edited by listingboat on

Replies

  • listingboatlistingboat Posts: 55Registered Users
    I've found the solution to this issue.

    If you want to have AVAudioPlayer and AVAssetWriter behave correctly together, you must have and audio session category that is 'mixable'.

    You can use a category that is mixable like AVAudioSessionCategoryAmbient.

    However, I needed to use AVAudioSessionCategoryPlayAndRecord.

    You can set any category to be mixable by implementing this:

        OSStatus propertySetError = 0;

    UInt32 allowMixing = true;

    propertySetError = AudioSessionSetProperty (
    kAudioSessionProperty_OverrideCategoryMixWithOthers, // 1
    sizeof (allowMixing), // 2
    &allowMixing // 3
    );
Sign In or Register to comment.