0

I've that function:

func retrievePixelBufferToDraw() -> CVPixelBuffer? {
  let time = self.playerItem!.currentTime()

  // this line is just added to make sure I can call something on self.videoOutput!
  self.videoOutput!.hasNewPixelBuffer(forItemTime: time)

  // raises EXC_BAD_ACCESS
  let pixelBuffer = self.videoOutput!.copyPixelBuffer(forItemTime: time, itemTimeForDisplay: nil)
  return pixelBuffer
}

It sounds like EXC_BAD_ACCESS comes from accessing deallocated variables, but I don't really see how that'd come into play here since I've checked all the variables I'm using before calling the line that fails.

Guig
  • 9,891
  • 7
  • 64
  • 126

1 Answers1

1

Simple.. Your AVPlayer is not getting video input at same time it is throwing the error EXC_BAD_ACCESS Try to give it QuickTimeMovie when you are playing (player.play()) always require video input.

At the end player should not be nill(without proper playerItem)

JAck
  • 854
  • 9
  • 18