This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Camera server died, while Hardware jpeg encoding...

Hi all,

In my case at HAL, I am taking YUV422 data from camera sensor and encoding into JPEG data using Hardware JPEG encoder (ti-dvsdk_dm3730-evm_04_03_00_06).

I am facing an random camera server died issue, while doing hardware jpeg encoding. My encoding application involves the following steps:

CERuntime_init()

Dmai_init()

Engine_open(..)

..

..

and so on.

While having a look on code and log, I see the crashes happens while executing CERuntime_init() funtion.

I enabled the ce and dmai logs and redirecting to logcat:

T:0x0000ad88 S:0x40862b74] OM - Memory_alloc> Enter(0x34)
I//system/bin/mediaserver( 1301): @232,421,699us: [+0 T:0x0000ad88 S:0x40862b74] OM - Memory_alloc> return (0x44b08)
I//system/bin/mediaserver( 1301): @232,421,699us: [+0 T:0x0000ad88 S:0x40862b1c] CE - rserverOpen('/system/ti-dsp/cs.x64P'), count = 0
I//system/bin/mediaserver( 1301): @232,421,730us: [+0 T:0x0000ad88 S:0x40862aec] OP - Processor_create> Enter(imageName='/system/ti-dsp/cs.x64P', linkCfg='(null)', attrs=0x40862b60)
I//system/bin/mediaserver( 1301): @232,421,791us: [+0 T:0x0000ad88 S:0x40862acc] OM - Memory_alloc> Enter(0x24)
I//system/bin/mediaserver( 1301): @232,421,821us: [+0 T:0x0000ad88 S:0x40862acc] OM - Memory_alloc> return (0x44b40)
I//system/bin/mediaserver( 1301): @232,421,821us: [+0 T:0x0000ad88 S:0x40862ad4] OP - doCmd> Enter (cmdId=1, proc=0x44b40)
I//system/bin/mediaserver( 1301): @232,421,852us: [+0 T:0x0000ad88 S:0x40862acc] ti.sdo.ce.osal.Sem - Entered Sem_post> sem[0x811d0]
I/logwrapper( 1301): /system/bin/mediaserver terminated by signal 11
W/AudioSystem( 1735): AudioFlinger server died!
W/IMediaDeathNotifier( 1735): media server died
E/MediaPlayer( 1735): error [ 869.864501] binder: 1735:1735 transaction failed 29189, size 64-0
(100, 0)
E/MediaPlayer( 1735): error (100, 0)
V/Camera ( 1735): binderDied
W/Camera ( 1735): Camera server died!
W/Camera ( 1735): ICamera died
W/AudioSystem( 1500): AudioFlinger server died!
W/AudioSystem( 1500): AudioPolicyService server died!
W/AudioSystem( 1404): AudioFlinger server died!
W/IMediaDeathNotifier( 1404): media server died
W/AudioSystem( 1404): AudioPolicyService server died!
I/ServiceManager( 1296): service 'media.audio_flinger' died
I/ServiceManager( 1296): service 'media.player' died
I/ServiceManager( 1296): service 'media.camera' died
I/ServiceManager( 1296): service 'media.audio_policy' died
W/MediaMetadataRetriever( 1590): MediaMetadataRetriever server died!
E/MediaPlayer( 1735): Error (100,0)
E/MediaPlayer( 1735): Error (100,0)
E/Camera ( 1735): Error 100
E/CameraUtils( 1735): Media(Camera) Server Died so release the camera
E/Camera ( 1735): Camera Error Encountered.

Attached complete log.

Thanks,

Naveen

  • Hi Naveen,

    As I reading the posted logs I can confirm that the crash appears in the CERuntime_init function but I suggest you to continue the debugging to localize what is exactly the reason for the issue by adding new debug message in the functions called in the CERuntime_init.

    BR

    Tsvetolin Shulev

  • Ok Tsvetolin,

    I will add some more debug messages and let you know.

    Thanks,

    Naveen

  • Hi Tsvetolin,

    I am not able to see the debug messages which I added in

    Processor_dsplink.c and Sem_posix.c files, which I need them to debug the issue.

    Can you put some light on this , why my changes are reflecting in final binary? (I checked that files are compiling)

    To get the logs for Engine.c files I added the following lines in the init.rc file:

    export CE_DEBUG 3

    export DMAI_DEBUG 2

    and

    service media /system/bin/logwrapper /system/bin/mediaserver

    Thanks,

    Naveen

  • Sorry typo error:

    Hi Tsvetolin,

    I am not able to see the debug messages which I added in

    Processor_dsplink.c and Sem_posix.c files, which I need them to debug the issue.

    Can you put some light on this , why my changes are not reflecting in final binary? (I checked that files are compiling)

    To get the logs for Engine.c files I added the following lines in the init.rc file:

    export CE_DEBUG 3

    export DMAI_DEBUG 2

    and

    service media /system/bin/logwrapper /system/bin/mediaserver

    Thanks,

    Naveen

  • Hi Naveen,

    The printing debug macro is GT_Xtrace, where X is the debug level  X = 0..7. You can get some description about how to debugging the Codec Engine at the linked article about CE_DEBUG:

    http://processors.wiki.ti.com/index.php/CE_DEBUG

    and you can get some additional clarification from the linked discussion:

    http://e2e.ti.com/support/embedded/linux/f/354/t/39918.aspx

    BR

    Tsvetolin Shulev

  • Thanks Tsvetolin for the reply.

    Could you please tell me, how the object code gets built and included into the final *.x64P binary from  codec_engine/packages/ti/sdo/ce/ipc/dsplink/ code and where I can found the object codes.

    Why I want to know this is, because only my prints (which i added or modified) not reflecting the final binary.

    Thanks,

    Naveen

  • Hi Naveen,

    Rebuilding Codec Engine is typically not necessary but in case of deep debugging as in your case it should be necessary. I suggest you the following article about rebuilding Codec Engine:

    http://processors.wiki.ti.com/index.php/Rebuilding_Codec_Engine

    After the full rebuilding of Codec Engine your prints should be appear.

    BR

    Tsvetolin Shulev

  • Hi Tsvetolin,

    I am rebuilding the ti-dsp and doing the same, as given in the link. But no help. I made sure modified files are getting compiled (Added errors while building, then not able to build). But not able see the added logs in logcat. Could you please tell me, how to debug this issue, why logs are not coming.

    Thanks,

    Naveen

  • Hi,


    I am  facing the same issue.On our platform we have two camera related applications.One is default android camera application. The second one is Project specific Medical application.The default camera capture is working fine with hardware encoding every time.The Mediacal application is working only for one capture and the next capture is hanging at "Engine_open(String("codecServer")"  with following error:

    W/AudioSystem( 1936): AudioFlinger server died!
    V/Camera  ( 1936): binderDied
    W/Camera  ( 1936): Camera server died!
    W/AudioSystem( 1936): AudioPolicyService server died!
    W/AudioSystem( 1626): AudioFlinger server died!
    V/Camera  ( 1626): binderDied
    W/Camera  ( 1626): Camera server died!
    W/Camera  ( 1626): ICamera died
    W/AudioSystem( 1552): AudioFlinger server died!
    W/AudioSystem( 1552): AudioPolicyService server died!
    W/AudioSystem( 1458): AudioFlinger server died!
    W/IMediaDeathNotifier( 1458): media server died
    W/AudioSystem( 1458): AudioPolicyService server died!
    I/ServiceManager( 1326): service 'media.audio_flinger' died
    I/ServiceManager( 1326): service 'media.player' died
    I/ServiceManager( 1326): service 'media.camera' died
    I/ServiceManager( 1326): service 'media.audio_policy' died
    W/MediaMetadataRetriever( 1677): MediaMetadataRetriever server died!
    E/Camera  ( 1626): Error 100.

    I found one strange thing is that, after device booting completed ,first open the default camera and take a capture then close it, and now open the Medical Application and do the continuous captures. With this scenario all captures are working fine without any crashes.

     Can any one suggest whether the issue is in the hardware encoder or in the application.

    Thanks.

    Balu.

  • Hi Balu,

    The issue seems very complicated and needs deep investigating with many debug massages to localize the reason for it but I only can guess that the problem is in the Audio Flinger or in the medical application. I can not exclude and some hardware issue with the second camera but it is unlikely.

    BR

    Tsvetolin Shulev

  • Thanks Tsvetolin Shulev ,

    I debugged the issue and found the root cause. 

    In the camera HAL layer, we are doing unmapping of preview buffers from user space to kernel space  (4 buffers for preview) while closing camera,since the generic camera application normally closes from the preview.

    We are using 2 buffers for capture.

    The medical application flow is as below :

    Open camera ->preview ->capture ->close camera. 

    Camera close directly after capture without comeback to preview. This is actually the requirement. Here we should unmap only 2 buffers since for capture we mapped 2 buffers. The default android camera closes from the preview,so no problem. Due to this medical application causing media server died and the next capture is hanging in the hardware encoding. 

    But this issue is not getting if I used software encoding in place of hardware encoding.

    I fixed the issue with proper checking. 

    I am trying why this issue I can't produce with software encoding. 

    Thanks, 

    Balu.