Hi,
is it possible to stream output from Android media recorder using socket or pipe to another NDK application on the same i.MX device that in turn streams it out? I have tried the followings to set outputfile of media recorder:
// recorder.setOutputFile("/data/data/com.persistentsystems.videocast/files/pipe0"); //pipe
// recorder.setOutputFile(pfd.getFileDescriptor()); //socket
recorder.setOutputFile("/sdcard/test_video.mp4"); //file
SharedFdPipe.cpp (proprietary code of Freescale) in OpenMAXIL/src/content_pipe/shared_fd_pipe generates illegal seek error when socket or pipe is used
as output of Mediarecorder:
02-11 21:53:14.560 I/OMXPlayer( 3658): LEVEL: 1 FUNCTION: SharedFdPipe_Open LINE: 39
02-11 21:53:14.560 I/OMXPlayer( 3658): SFD open sharedfd://28:0:0
02-11 21:53:14.560 I/OMXPlayer( 3658): LEVEL: 1 FUNCTION: SharedFdPipe_Open LINE: 59
02-11 21:53:14.560 I/OMXPlayer( 3658): seek to pos: 0 failed, errno: Illegal seek
When file is used as output of media recorder, recording could be done successfully:
02-11 22:01:20.820 I/OMXPlayer( 4603): LEVEL: 1 FUNCTION: SharedFdPipe_Open LINE: 39
02-11 22:01:20.820 I/OMXPlayer( 4603): SFD open sharedfd://28:0:0
02-11 22:01:20.830 I/vpu-lib ( 4603): <gpu> alloc handle: 0x4c3f4cc0, paddr: 0x3e1df000, vaddr: 0x4a113000
02-11 22:01:20.830 I/xx ( 4841): C
02-11 22:01:20.830 I/OMXPlayer( 4603): start recorder.
Thank you so much for your help.
Could GMRecorder::setOutputFileFD be modified NOT to use sharedfd for gm_path
sprintf(gm_path, "sharedfd://%d:%lld:%lld", mSharedFd, offset, length);
but to use UdpsPipe? Should it be?
sprintf(gm_path, "udp://%d:%lld:%lld", mSharedFd, offset, length);
After modifying to use UdpsPipe in GMRecorder::setOutputFileFD
sprintf(gm_path, "udp://%d:%lld:%lld", mSharedFd, offset, length);
and to use udp socket fd in setOutputFile
recorder.setOutputFile(pfd.getFileDescriptor()); //socket
crash appears as follow:
02-12 18:03:32.337 I/vpu-lib ( 4623): <gpu> alloc handle: 0x415945a8, paddr: 0x38710000, vaddr: 0x4572c000
02-12 18:03:32.337 I/vpu-lib ( 4623): ringBufferEnable 0, chromaInterleave 1, mapType 1, linear2TiledEnable 1
02-12 18:03:32.337 F/libc ( 4623): @@@ ABORTING: invalid address or address of corrupt block 0x4164d460 passed to dlfree
02-12 18:03:32.337 F/libc ( 4623): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 5099 (mediaserver)
02-12 18:03:32.347 I/vpu-lib ( 4623): <gpu> alloc handle: 0x415945c0, paddr: 0x3e019000, vaddr: 0x4b035000
02-12 18:03:32.667 I/DEBUG ( 2416): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-12 18:03:32.667 I/DEBUG ( 2416): Build fingerprint: 'waverelay/full_mpu5/mpu5:4.3/JSS15J/eng.jbodino.20141020.101151:user/dev-keys'
02-12 18:03:32.667 I/DEBUG ( 2416): Revision: '405522'
02-12 18:03:32.667 I/DEBUG ( 2416): pid: 4623, tid: 5099, name: mediaserver >>> /system/bin/mediaserver <<<
02-12 18:03:32.667 I/DEBUG ( 2416): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
02-12 18:03:32.667 I/DEBUG ( 2416): Abort message: '@@@ ABORTING: invalid address or address of corrupt block 0x4164d460 passed to dlfree'
02-12 18:03:32.677 W/NativeCrashListener( 2714): Couldn't find ProcessRecord for pid 4623
02-12 18:03:32.767 I/DEBUG ( 2416): r0 00000027 r1 00000000 r2 00000008 r3 deadbaad
02-12 18:03:32.767 I/DEBUG ( 2416): r4 00000000 r5 4e0ea974 r6 4000b000 r7 4164d468
02-12 18:03:32.767 I/DEBUG ( 2416): r8 40e49218 r9 410c4237 sl 8000100e fp 40e4c2b8
02-12 18:03:32.767 I/DEBUG ( 2416): ip 00000001 sp 4e0ea970 lr 4021e12b pc 4021b684 cpsr 60070030
02-12 18:03:32.767 I/DEBUG ( 2416): d0 0000000000000000 d1 0000000000000000
02-12 18:03:32.767 I/DEBUG ( 2416): d2 0000000000000000 d3 0000000000000000
02-12 18:03:32.767 I/DEBUG ( 2416): d4 3fcaa1a0953f52d4 d5 bebbb74342c19da4
02-12 18:03:32.767 I/DEBUG ( 2416): d6 3e66376972bea4d0 d7 3f80000080cd85cf
02-12 18:03:32.767 I/DEBUG ( 2416): d8 0000000000000000 d9 0000000000000000
02-12 18:03:32.767 I/DEBUG ( 2416): d10 0000000000000000 d11 0000000000000000
02-12 18:03:32.767 I/DEBUG ( 2416): d12 0000000000000000 d13 0000000000000000
02-12 18:03:32.777 I/DEBUG ( 2416): d14 0000000000000000 d15 0000000000000000
02-12 18:03:32.777 I/DEBUG ( 2416): d16 3fa1cbc4e2559733 d17 0000000000000000
02-12 18:03:32.777 I/DEBUG ( 2416): d18 0000000000000000 d19 bfc781bb09000000
02-12 18:03:32.777 I/DEBUG ( 2416): d20 3fc5524416f6467c d21 bf66bcbf933eb23c
02-12 18:03:32.777 I/DEBUG ( 2416): d22 bfc839d0ffa746ac d23 3fd0000000000000
02-12 18:03:32.777 I/DEBUG ( 2416): d24 3f9041eae95bdec5 d25 bf9041eaefea5a92
02-12 18:03:32.777 I/DEBUG ( 2416): d26 3f6328e1cb8c85e0 d27 4000000000000000
02-12 18:03:32.777 I/DEBUG ( 2416): d28 4001839d0ffa746b d29 3fc5797dab02b4ae
02-12 18:03:32.777 I/DEBUG ( 2416): d30 3ff0000000000000 d31 3fcaa1a0953f52d4
02-12 18:03:32.777 I/DEBUG ( 2416): scr 68000010
02-12 18:03:32.787 I/DEBUG ( 2416):
02-12 18:03:32.787 I/DEBUG ( 2416): backtrace:
02-12 18:03:32.787 I/DEBUG ( 2416): #00 pc 0001e684 /system/lib/libc.so
02-12 18:03:32.787 I/DEBUG ( 2416): #01 pc 0001c550 /system/lib/libc.so (abort+4)
02-12 18:03:32.787 I/DEBUG ( 2416): #02 pc 000121f1 /system/lib/libc.so
02-12 18:03:32.787 I/DEBUG ( 2416): #03 pc 00010ea1 /system/lib/libc.so (dlfree+1184)
02-12 18:03:32.787 I/DEBUG ( 2416): #04 pc 0000d9df /system/lib/libc.so (free+10)
02-12 18:03:32.787 I/DEBUG ( 2416): #05 pc 00001f53 /system/lib/lib_omx_osal_v2_arm11_elinux.so (fsl_osal_dealloc+2)
02-12 18:03:32.787 I/DEBUG ( 2416): #06 pc 0000548d /system/lib/lib_mp4_muxer_arm11_elinux.so
02-12 18:03:32.787 I/DEBUG ( 2416): #07 pc 000052cb /system/lib/lib_mp4_muxer_arm11_elinux.so (MP4DeleteMuxer+22)
02-12 18:03:32.787 I/DEBUG ( 2416): #08 pc 0000540f /system/lib/lib_mp4_muxer_arm11_elinux.so (MP4CreateMuxer+150)
02-12 18:03:32.787 I/DEBUG ( 2416): #09 pc 00001ecf /system/lib/lib_omx_fsl_muxer_v2_arm11_elinux.so (FslMuxer::InitMuxer()+34)
02-12 18:03:32.787 I/DEBUG ( 2416): #10 pc 0001b4ad /system/lib/lib_omx_common_v2_arm11_elinux.so (Muxer::InstanceInit()+76)
02-12 18:03:32.787 I/DEBUG ( 2416): #11 pc 0000d077 /system/lib/lib_omx_common_v2_arm11_elinux.so (IdleState::ToExecuting()+10)
02-12 18:03:32.787 I/DEBUG ( 2416): #12 pc 0000ece7 /system/lib/lib_omx_common_v2_arm11_elinux.so (State::ProcessCmd()+134)
02-12 18:03:32.787 I/DEBUG ( 2416): #13 pc 0000ca17 /system/lib/lib_omx_common_v2_arm11_elinux.so (DoThread(void*)+138)
02-12 18:03:32.787 I/DEBUG ( 2416): #14 pc 0000ca78 /system/lib/libc.so (__thread_entry+72)
02-12 18:03:32.797 I/DEBUG ( 2416): #15 pc 0000cbf4 /system/lib/libc.so (pthread_create+208)
Any good suggestion? Thank you so much,