FaceTime Camera preview crash in 'pjsua_vid_preview_start()' on OSX 10.10 (Yosemite)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Because QTkit is deprecated in favour of AVFoundation, there are some issues with video in pjsip, specifically on latest OSX versions. Here is a short explanation of a strange problem, how to replicate it and a quick workaround.

Problem:

Seems that on OSX 10.10 some native applications (QuickTime Player) change the pixel format of the integrated FaceTime camera to a format that pjsip does not support: kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange (?420v?).
As a result of this, pjsip video subsystem cannot find valid pixel format which results in an unusable capture device. Call to 'pjsua_vid_preview_start()' will crash application.

Now the interesting part: once started capture on that device (from pjsip, skype and probably other apps as well), it will immediatelly revert it?s pixel format to the one that pjsip supports (the default one actually):  PJMEDIA_FORMAT_YUY2 (kCVPixelFormatType_422YpCbCr8_yuvs).

Steps to replicate the problem:

1. Start QuickTime -> New Movie Recording
2. Stop recording
3. Start pjsip app (it is important to start it after steps 1 and 2, only in pjsua_init we set device pixel format. if app is already running while doing step 1 and 2, all works fine).
4. Show preview window: pjsua_vid_preview_start(). App crashes with an assertion failure.

Qucik Fix until actual backend is changed from QTKit to AVFoundation:

Update supported formats and map kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange -> PJMEDIA_FORMAT_YUY2. Although this is not correct format mapping, it is not important because as soon as we start capturing on the device, it actually changes it?s pixel format to PJMEDIA_FORMAT_YUY2, which is standard supported pixel format on OSX platform.

--- a/pjmedia/src/pjmedia-videodev/qt_dev.m
+++ b/pjmedia/src/pjmedia-videodev/qt_dev.m
@@ -45,6 +45,7 @@ static qt_fmt_info qt_fmts[] =
{
    {PJMEDIA_FORMAT_YUY2, kCVPixelFormatType_422YpCbCr8_yuvs},
    {PJMEDIA_FORMAT_UYVY, kCVPixelFormatType_422YpCbCr8},
+       {PJMEDIA_FORMAT_YUY2, kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange},
};


Denis


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux