• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AVAssetReader crashing under 10.8.2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AVAssetReader crashing under 10.8.2


  • Subject: Re: AVAssetReader crashing under 10.8.2
  • From: Christopher Ashworth <email@hidden>
  • Date: Wed, 02 Oct 2013 11:52:30 -0400

Hi again all,

I'm happy to report that we eventually found a workaround for this, which I'll share here in hopes of helping some future developer searching through the archives:

It appears that Apple's code has a race condition when you cancel an AVAssetReader that is still spinning up from a call to startReading.

We managed to mostly (entirely?) avoid this crash by adding a delay of 200ms before our call to cancelReading, which in our code can sometimes happen quickly after we call startReading.  e.g.:

    AVAssetReader *localReader = _reader; // local variables are retained by blocks
    double delayInSeconds = 0.2;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
    dispatch_after(popTime, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
        [localReader cancelReading];
    });

Hope that helps someone,

Chris

On Aug 14, 2013, at 9:57 AM, Christopher Ashworth <email@hidden> wrote:

HI all,

We're also encountering this crash in the AQClient thread, now in 10.8.4.  It has been difficult for us to recreate ourselves, but it's far and away our most common crash.

I spoke with the original poster (Michael) off list and it sounds like our scenarios are similar: we're both handling all buffering, playback, and sync directly. We use AVAssetReader to extract and then buffer frames on a background thread.  

In our case, our code can operate both reading using CoreAudio (ExtAudioFileRef) or AVAssetReader.  The two code paths have minimal differences, except for this crash.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: AVAssetReader crashing under 10.8.2
      • From: Matthias Hänel <email@hidden>
    • Re: AVAssetReader crashing under 10.8.2
      • From: Christopher Ashworth <email@hidden>
  • Prev by Date: Setting up SoundConverter
  • Next by Date: Finding a hidden device kIOAudioEngineIsHiddenKey kAudioDevicePropertyIsHidden
  • Previous by thread: Re: Setting up SoundConverter
  • Next by thread: Re: AVAssetReader crashing under 10.8.2
  • Index(es):
    • Date
    • Thread