01-01-2013 12:14 AM
Hi
I am accessing H264 encoder through camera service.
In my test example, following is the code flow
camera_open(...)
camera_set_videovf_property(...)
camera_set_video_property(....,CAMERA_IMGPROP_VIDE
camera_start_video_viewfinder(....)
camera_start_encode(..,enc_video_callback)
But encoded callback i.e. enc_video_callback is not getting called. In what circumstances, enc_video_callback will not get called?
Thanks,
Sachin Hambar
01-01-2013 01:09 AM
Addition Information:
To see the status of the functions, I added status_callback for
camera_start_video_viewfinder and camera_start_encode.
I am getting following status
1. CAMERA_STATUS_VIDEOVF for camera_start_video_viewfinder
2. CAMERA_STATUS_VIDEO_RESUME for both camera_start_video_viewfinder and camera_start_encode.
I am configuring following parameters for H264 encoder.
CAMERA_IMGPROP_WIDTH : 480
CAMERA_IMGPROP_HEIGHT : 640
CAMERA_IMGPROP_FRAMERATE : 30 fps
CAMERA_IMGPROP_BITRATE : 400000 bits/sec
I dont have any clue to proceed further and stuck now.
Does BB10 has system logging? How can I see the system logs for the issue mentioned above.
01-01-2013 03:31 AM
did you set video viewfinder to the same resolution as the video output? (480x640)
have you checked the error codes returned by all of the camera_() functions?
can you try with a higher bitrate? I've been testing this stuff recently, so I know it works.
there is indeed system-level logging for most of this, but it is inaccessible to non-root users.
01-01-2013 04:45 AM
1. Yes I set the video resolution same for camera_set_videovf_property and camera_set_video_property.
2. None of camera API calls return error. All APIs return success.
3. Yes I will try higher bitrate.
Can you please elaborate more on system logging? What do mean by "inaccessible to non-root users".
Is there any way to view the log the IDE?
01-02-2013 08:45 AM
sachinhambar wrote:
Can you please elaborate more on system logging? What do mean by "inaccessible to non-root users".
Is there any way to view the log the IDE?
There is no way for you to view the internal system logs.
01-02-2013 08:48 AM
Also, back to your problem... please try downloading the HelloVideoCamera sample from github:
https://github.com/blackberry/Cascades-Community-S
Then just replace the call to camera_start_video() with camera_start_encode() instead. Likewise: camera_stop_video() -> camera_stop_encode().
Also, be sure your callback functions are static if they are C++ class members.
Cheers,
Sean
01-22-2013 01:04 AM
I got the reason for callback not gettig called. It is related to thread priority assigned in our code. In our code, all thread priority are set to high
const int maxPrio = sched_get_priority_max(policy);
// Set same priority for all threads
param.sched_priority = maxPrio - 1;
error_code = pthread_setschedparam(thread_, policy, ¶m);
It seems the encoder thread has lower priority so the callback is not getting called. Once I removed the thread priorities, callback got called.
01-22-2013 12:09 PM
yes, please don't try to use maximum priority.
there are a number of system services and interrupt handlers, etc. which could get starved out if your threads are poorly behaved.
I would suggest working in a small relative range from your starting priority.
we only typically set priorities to current priority, or current+1 relative to the parent thread.