Hi Satender,
I'm not sure why std::cerr isn't working for you, but printf_stderr()
can be used to add additional log statements to the camera code.
The DOM_CAMERA_LOGx() statements that are already there use the
PRLogging mechanism, which is only enabled in debug builds. To make a
debug build, you need to set B2G_DEBUG=1 in the environment for build.sh.
Once you have a debug build, you need to run b2g with
NSPR_LOG_MODULES=Camera:N (where 0 <= N <= 5) in its environment, such
as by modifying /system/bin/b2g.sh on your unagi. N: 1, errors; 2,
warnings; 3, other info; 4, "trace"--function entry and exit points,
class ctors and dtors; 5, reference count logging. (Setting Camera:5
generates HUGE amounts of logging!)
--m.
On 13-01-15 06:00 AM, Satender Saroha wrote:
Hi,
I have just finished compiling the B2G codebase for unagi device on Mac OSX
Mountain Lion 10.8.2 using the steps here:
https://intranet.mozilla.org/B2G_Team/Unagi#Build
I am successfully able to flash it on the unagi device (from turkcell) using
./flash.sh. Running the default build on device seems to be okay for the most
part. I do encounter a failure to save photos taken from the camera.
As a next step, I added some log stmts, just to get some confidence that my
local changes are able to make to the device successfully.
Specifically, I modified camera related gecko files to see if the log stmts get
printed when camera is opened in preview mode.
Here is the file with method names I modified:
B2G/gecko/dom/camera/DOMCameraPreview.cpp
3 methods modified:
/////////// start of modified code snippet in file DOMCameraPreview.cpp
///////////
DOMCameraPreviewListener(DOMCameraPreview* aDOMPreview) :
mDOMPreview(aDOMPreview)
{
+ std::cerr << "Inside DOMCameraPreviewListener" << std::endl;
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
}
DOMCameraPreview::DOMCameraPreview(ICameraControl* aCameraControl, uint32_t
aWidth, uint32_t aHeight, uint32_t aFrameRate)
: nsDOMMediaStream()
, mState(STOPPED)
, mWidth(aWidth)
, mHeight(aHeight)
, mFramesPerSecond(aFrameRate)
, mFrameCount(0)
, mCameraControl(aCameraControl)
{
DOM_CAMERA_LOGT("%s:%d : this=%p : mWidth=%d, mHeight=%d,
mFramesPerSecond=%d\n", __func__, __LINE__, this, mWidth, mHeight, mFramesPerSecond);
+ std::cerr << "Satender: DOMCameraPreview constructor: width" << mWidth << " frames per
second: " << mFramesPerSecond << std::endl;
void
DOMCameraPreview::Start()
{
+ std::cerr << " Starting preview stream\n" << std::endl;
NS_ASSERTION(NS_IsMainThread(), "Start() not called from main thread");
if (mState != STOPPED) {
return;
}
DOM_CAMERA_LOGI("Starting preview stream\n");
...
//////////////// end of code snippet //////////
After doing a rebuild, when I flash the device with latest build, I do not see the
log stmts getting printed, when i open the camera after attaching adb to view the
log output like this: adb logcat -v time > /tmp/x
In fact any of the DOM_CAMERA_LOGI stmts are NOT getting printed in the adb
logcat output.
I looked at the timestamp of .o file to make sure .build.sh did recompile DOMCameraPreview.cpp. Looking at the timestamp of .o does confirm that it indeed got recompiled.
ssaroha$ ls -ltr ~/b2g/B2G/objdir-gecko/dom/camera/DOMCameraPreview.o
-rw-r--r-- 1 ssaroha staff 418520 Jan 15 14:46
/Users/ssaroha/b2g/B2G/objdir-gecko/dom/camera/DOMCameraPreview.o
Any ideas as to why the log stmts directed to stderr are not visible in the adb
logs. Also why DOM_CAMERA_LOGI stmt is not visible. Please note that if I
modify one of the existing log stmts which I was seeing in the logcat output,
then that change does get reflected in the next build run ont the device. For
example I made the following change to the file,
~/b2g/B2G/gecko/ipc/glue/AsyncChannel.cpp:
errorMsg = "Channel closing (Satender): too late to send/recv, messages will be
lost";
and I do see my name showing up in the logs like this:
01-15 15:11:02.409 I/Gecko ( 369): ###!!! [Child][RPCChannel] Error: Channel
closing (Satender): too late to send/recv, messages will be lost
Its almost like I am missing some configuration setting which is preventing any
logs from DOM code to make it to adb logs.
Any ideas what am I missing. Thanks for any pointers
Satender
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g