yeahua / spydroid-ipcamera

Automatically exported from code.google.com/p/spydroid-ipcamera
GNU General Public License v3.0
0 stars 0 forks source link

VideoStream : Camera server crashes when setVideoEncoder is called #62

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Was running the code with r140 on Motorola Atrix 2
2. The Camera always crashes
3. Modified the code to detect the crash and initialize the recorder without 
incorporating the camera.

What is the expected output? What do you see instead?
--

What version of the product are you using? On what operating system?
r140

Please provide any additional information below.

Attaching the modified VideoStream.java file. This works for Atrix 2, but 
stutters in the first attempt to stream. Thereafter it is fine.

My customization may not be optimum. Feel free to adapt. 
BTW, I expect to spend significant time in this area (media streaming) over 
next few months; can support you to maintain and test on some platforms.

Original issue reported on code.google.com by chotayth...@gmail.com on 10 Jul 2012 at 11:27

Attachments:

GoogleCodeExporter commented 8 years ago
Hi !

I've modified VideoStream.java but i'm not satisfied, this doesn't fill right 
at all:
1) I don't know from what thread the ErrorCallack is called, the camera could 
be used by two thread at the same time here :/
2) This patch won't work if the ErrorCallback is called after the test "if 
(cameraError)..."
3) Have you tried to use a MediaRecorder with a Camera in a very basic case to 
see if it works ? Maybe there's something wrong with my code in the first place 
?? (Could be the camera.reconnect() or the camera.setParameters(blabla)...)

Thank you anyway ! It's nice of you to help me out 

Original comment by FyHertz on 11 Jul 2012 at 2:38

GoogleCodeExporter commented 8 years ago
Hi,
     Frankly even I was not satisfied with the fix. But I have not found
any other reference or approach to fix the issue. Most likely this is a
TI/OMAP4 Hal specific issue on which only Motorola / TI can provide a
better implementation to really resolve it.

The Camera was always crashing when the code
"super.setVideoEncoder(videoEncoder);" was called. I have not tried
alternative approaches to bring camera in the record path, while also
setting the video encoder. Will revert with my observations; if I get it to
work. But then we seem to be trying to resolve issues that Mot/TI should
fix in the first place.

As you correctly captured there can be race conditions wherein on faster
systems, we may not catch the issue. Also we may have multiple threads
dealing with camera. None of this seems to be part of documented Android
behavior. But the thread on which the callback happens for my device is the
same thread as the one that is running "prepare".

I am attaching the complete logs for your reference. The scenario had two
attempts to play from mplayer (the android app saw a total of three
connection requests). The full logs shows issues on 07-12 10:02:44.101:
E/CameraInput(22349): Unsupported
parameter(x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_valu
e)

----
07-12 10:02:44.086: D/OMXCameraAdapter(22349):
hardware/ti/omap4/omap3/camera-omap4/src/OMXCameraAdapter/OMXCameraAdapter.cpp:8
302
setLedFlash - old LedIntensity.nLedFlashIntens is: 100
07-12 10:02:44.086: D/OMXCameraAdapter(22349):
hardware/ti/omap4/omap3/camera-omap4/src/OMXCameraAdapter/OMXCameraAdapter.cpp:8
305
setLedFlash - new LedIntensity.nLedFlashIntens is: 100
07-12 10:02:44.086: D/OMXCameraAdapter(22349):
hardware/ti/omap4/omap3/camera-omap4/src/OMXCameraAdapter/OMXCameraAdapter.cpp:8
352
setLedTorch - old LedIntensity.nLedTorchIntens is: 40
07-12 10:02:44.086: D/OMXCameraAdapter(22349):
hardware/ti/omap4/omap3/camera-omap4/src/OMXCameraAdapter/OMXCameraAdapter.cpp:8
369
setLedTorch - new LedIntensity.nLedTorchIntens is: 40
07-12 10:02:44.086: E/CameraHal(22349):
hardware/ti/omap4/omap3/camera-omap4/src/CameraHal.cpp:1085 setParameters -
Positive bracketing range 1
07-12 10:02:44.086: E/CameraHal(22349):
hardware/ti/omap4/omap3/camera-omap4/src/CameraHal.cpp:1096 setParameters -
Negative bracketing range 1
07-12 10:02:44.086: D/CameraHal(22349):
hardware/ti/omap4/omap3/camera-omap4/src/CameraHal.cpp:1155 setParameters -
mReloadAdapter 0
07-12 10:02:44.086: D/CameraHal(22349):
hardware/ti/omap4/omap3/camera-omap4/src/CameraHal.cpp:247 disableMsgType -
Disabling Preview Callback
07-12 10:02:44.101: E/CameraInput(22349): Unsupported
parameter(x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_valu
e)
07-12 10:02:44.101: E/CameraInput(22349): VerifiyAndSetParameter failed on
parameter #0
07-12 10:02:44.101: D/OMXCameraAdapter(22349):
hardware/ti/omap4/omap3/camera-omap4/src/OMXCameraAdapter/OMXCameraAdapter.cpp:2
457
getParameters - OMXCameraAdapter - getParametersOMX -
exposure.nShutterSpeedMsec = 60
07-12 10:02:44.101: D/OMXCameraAdapter(22349):
hardware/ti/omap4/omap3/camera-omap4/src/OMXCameraAdapter/OMXCameraAdapter.cpp:2
458
getParameters - OMXCameraAdapter - getParametersOMX - exposure.nSensitivity
= 100
07-12 10:02:44.109: W/AudioSystem(536): AudioFlinger server died!
07-12 10:02:44.109: W/AudioSystem(536): AudioPolicyService server died!
07-12 10:02:44.109: I/ServiceManager(255): service 'media.audio_flinger'
died
07-12 10:02:44.109: I/ServiceManager(255): service 'media.player' died
07-12 10:02:44.109: I/ServiceManager(255): service 'media.camera' died
07-12 10:02:44.109: I/ServiceManager(255): service 'media.audio_policy' died
07-12 10:02:44.109: W/IMediaDeathNotifier(22702): media server died
07-12 10:02:44.109: W/Camera(22702): Camera server died!
07-12 10:02:44.109: W/Camera(22702): ICamera died
07-12 10:02:44.117: E/Camera(22702): Error 100
07-12 10:02:44.117: E/VideoStream(22702): Camera.OnError
07-12 10:02:44.141: I/MediaRecorderJNI(22702): prepare: surface=0x2df320
(identity=2571)

Original comment by chotayth...@gmail.com on 12 Jul 2012 at 4:49