Analysis and countermeasure of black screen for driving record application based on android4.4 system

Source: Internet
Author: User
Tags diff

Analysis and countermeasure of black screen for driving record application based on android4.4 system

The author recently encountered a thorny problem, that is, the application of driving record black screen problem, the phenomenon is to enter the driving record application surface is black, video files a few minutes of the kind, each file size is 0 . See this everyone attaches great importance, for car products, driving record function need to maintain a long time normal work, this problem is definitely unacceptable, must be solved! So how did this problem come about?

        followed a long time, at the same time using the 8 12 24 H, that's it. 2-3 3x24 1-2

/*****************************************************************************************************/
Disclaimer: The content of this blog is by http://blog.csdn.net/edsam49 original, reproduced please indicate the source, thank you!
/*****************************************************************************************************/

to solve the problem, we can only do more experiments, add some test code for debugging, in addition to the need to add a continuous capture system printing information function, otherwise it is so long, it is impossible to take a machine next to catch print it! Even if can, also very inconvenient is not, also not so many computers to do a machine with a pc Bar! Continuous catch printing This function is relatively simple, the author wrote a similar blog post more than a year ago, there is a need to go through.

First Look at the problem when the print is what kind of state it!

10-09 01:10:32.670 E/v4l2cameradevice (1205): Select timeout10-09 01:10:32.670 w/v4l2cameradevice (1205): Wait v4l2 Buffe R Time out10-09 01:10:32.670 W/v4l2cameradevice (1205): Nmcuravailbuffercnt:2 10-09 01:10:32.670 W/V4L2CameraDevice (120 5): buffer:0 (refcnt:0 index:0) 10-09 01:10:32.670 W/v4l2cameradevice (1205): Buffer:1 (refcnt:1 index:1) 10-09 01:10:32.670 W/V4L2CameraDevice (1205): Buffer:2 (refcnt:1 index:2) 10-09 01:10:32.670 w/v4l2cameradevice (1205): Buffer:3 (refcnt:1 index:3) 10-09 01:10:32.6 W/v4l2cameradevice (1205): Buffer:4 (refcnt:1 index:4) 10-09 01:10:32.670 w/v4l2cameradevice (1205): Buffer:5 (RefC nt:0 index:5) 10-09 01:10:32.670 w/v4l2cameradevice (1205): Buffer:6 (refcnt:1 index:6) 10-09 01:10:32.670 W/V4L2CameraD Evice (1205): preview_num:0, picture_num:010-09 01:10:33.110 D/DALVIKVM (+): Gc_for_alloc freed 1603K, 40% free 4102K /6796k, paused 51ms, total 51ms10-09 01:10:34.690 e/v4l2cameradevice (1205): Select timeout10-09 01:10:34.690 w/v4L2cameradevice (1205): Wait v4l2 buffer time out10-09 01:10:34.690 W/v4l2cameradevice (1205): Nmcuravailbuffercnt:2 10-09 01:10:34.690 W/v4l2cameradevice (1205): buffer:0 (refcnt:0 index:0) 10-09 01:10:34.690 W/v4l2cameradevice (1205): Buffer:1 (refcnt:1 index:1) 10-09 01:10:34.690 W/V4L2CameraDevice (1205): Buffer:2 (refcnt:1 index:2) 10-09 01:10:34.690 w/v4l2cameradevice (1205): Buffer:3 (refcnt:1 index:3) 10-09 01:10:34.6 W/v4l2cameradevice (1205): Buffer:4 (refcnt:1 index:4) 10-09 01:10:34.690 w/v4l2cameradevice (1205): Buffer:5 (RefC nt:0 index:5) 10-09 01:10:34.690 w/v4l2cameradevice (1205): Buffer:6 (refcnt:1 index:6) 10-09 01:10:34.690 W/V4L2CameraD Evice (1205): preview_num:0, picture_num:010-09 01:10:35.500 D/DALVIKVM (+): Gc_for_alloc freed 1392K, 40% free 4102K /6796k, paused 44ms, total 44ms10-09 01:10:36.700 e/v4l2cameradevice (1205): Select timeout10-09 01:10:36.700 w/v4l2camer Adevice (1205): Wait v4l2 buffer time out10-09 01:10:36.700 W/v4l2cameradeviCE (1205): Nmcuravailbuffercnt:2 10-09 01:10:36.700 W/v4l2cameradevice (1205): buffer:0 (refcnt:0 index:0) 10-09 01:10:36.700 W/v4l2cameradevice (1205): Buffer:1 (refcnt:1 index:1) 10-09 01:10:36.700 W/V4L2CameraDevice (1205): Buffer:2 (refcnt:1 index:2) 10-09 01:10:36.700 w/v4l2cameradevice (1205): Buffer:3 (refcnt:1 index:3) 10-09 01:10:36.7 W/v4l2cameradevice (1205): Buffer:4 (refcnt:1 index:4) 10-09 01:10:36.700 w/v4l2cameradevice (1205): Buffer:5 (RefC nt:0 index:5) 10-09 01:10:36.700 w/v4l2cameradevice (1205): Buffer:6 (refcnt:1 index:6) 10-09 01:10:36.700 W/V4L2CameraD Evice (1205): preview_num:0, picture_num:010-09 01:10:37.050 d/mxnavi-jni (2726): Send_msg_to_control Onupdateguidepointinfo pturninfo highspeedflag:1,uldistance370,destinationdistance:796,ulturnid:5---- eeyeguideinfo{0-0-0}10-09 01:10:37.080 D/mxnavi-jni (2726): Send_msg_to_control onupdateguidepointinfo Pturninfo Highspeedflag:1,uldistance370,destinationdistance:796,ulturnid:5----eeyeguideinfo{0-0-0}10-09 01:10:37.190 D/mxnavi-jni (2726): snd_start_play_sound10-09 01:10:37.190 V/jeavox (1657): MiddleWareService o nnaviinfospecialstatuschanged### #1 110-09 01:10:37.190 I/jeavox (1657): Middlewareservice NaviAudiowillPlay# #1NAVI_ Radar_coming 010-09 01:10:37.920 D/DALVIKVM (): Gc_for_alloc freed 1430K, 40% free 4102k/6796k, paused 47ms, total 48m s10-09 01:10:38.710 E/v4l2cameradevice (1205): Select timeout10-09 01:10:38.710 w/v4l2cameradevice (1205): Wait v4l2 buff Er time out10-09 01:10:38.710 w/v4l2cameradevice (1205): Nmcuravailbuffercnt:2 10-09 01:10:38.710 W/V4L2CameraDevice (12 ): buffer:0 (refcnt:0 index:0) 10-09 01:10:38.710 W/v4l2cameradevice (1205): Buffer:1 (refcnt:1 index:1) 10-09 01:10:38.710 W/V4L2CameraDevice (1205): Buffer:2 (refcnt:1 index:2) 10-09 01:10:38.710 w/v4l2cameradevice (1205): Buffer:3 (refcnt:1 index:3) 10-09 01:10:38.7 W/v4l2cameradevice (1205): Buffer:4 (refcnt:1 index:4) 10-09 01:10:38.710 w/v4l2cameradevice (1205): Buffer:5 (Refcnt:0 index:5) 10-09 01:10:38.710 w/v4l2cameradevice (1205): Buffer:6 (refcnt:1 index:6) 10-09 01:10:38.710 W/V4L2Came Radevice (1205): preview_num:0, picture_num:010-09 01:10:40.180 d/clock_component (1205):----Adjust ratio:1, precise_a Djust_ratio:1, ref:2703668109 sys:2703728392 diff:-60283 diff-percent:-1----10-09 01:10:40.230 D/DALVIKVM (): GC_ For_alloc freed 1409K, 40% free 4102k/6796k, paused 54ms, total 55ms10-09 01:10:40.720 e/v4l2cameradevice (1205): Select t imeout10-09 01:10:40.720 W/v4l2cameradevice (1205): Wait v4l2 buffer time out10-09 01:10:40.720 W/v4l2cameradevice (1205) : Nmcuravailbuffercnt:2 10-09 01:10:40.720 W/v4l2cameradevice (1205): buffer:0 (refcnt:0 index:0) 10-09 01:10:40.720 W/v4l2cameradevice (1205): Buffer:1 (refcnt:1 index:1) 10-09 01:10:40.720 W/V4L2CameraDevice (1205): Buffer:2 (refcnt:1 index:2) 10-09 01:10:40.720 w/v4l2cameradevice (1205): Buffer:3 (refcnt:1 index:3) 10-09 01:10:40.7 W/v4l2cameradevice (1205): Buffer:4 (refcnt:1Index:4) 10-09 01:10:40.720 w/v4l2cameradevice (1205): Buffer:5 (refcnt:0 index:5) 10-09 01:10:40.720 W/V4L2CameraDevice (1205): Buffer:6 (refcnt:1 index:6)

      is obviously select timed out, why did it time out? is due to buffer question! Not enough empty buffer ! The above print has each buffer refcnt from the print analysis of a video encoding may not be normal release, resulting in the failure to release the cause may be more busy system tasks, may be SD card read and write speed, resulting in short traffic jams, buffer No, I still suspect the video coding module is not working properly. But there is a very real problem, that is the problem in the original side is not very important, but also the company status is not good match, also because the industry has not contributed their GDP the fist. What can you do if people don't devote so much effort to help you? Tell the boss, the factory does not solve, we have no way! Certainly not, many objective conditions we can not balance the short-term solution. That's gotta be a trick!

The author in the test found that after each black screen, the application needs to exit all, and then open, and can work normally. In the HAL layer problem, once the issue of this select Timeout, it is not self-healing, how long is the same, then I think you can always find ways to let the application know it! The above know this matter, there is no way to solve it! Although this is not the best solution, but it is the current situation of the various! It takes about 1 seconds to stop and re-open, which means one second of data is lost. It seems to me that this is an acceptable range!

So how do you report it? In fact , the camera has a ready-made set, as long as the use of the good! In Camera.java There is an important interface as follows:

    /**     * Registers a callback to being invoked when an error occurs.     * @param CB The callback to run     *    /public final void Seterrorcallback (Errorcallback cb)    {        Merrorcallback = CB;    }

      Registering with this interface may be a listening error, registering is equivalent to having a hook waiting there! How do you throw that bait? Still have to look at v4l2cameradevice.cpp There's already a ready-made mcallbacknotifier and mcallbacknotifier It also has a () such a ready-made interface, that's not easy!

        so in select time out of place, directly through mcallbacknotifier go Span style= "color: #333333;" >call oncameradeviceerror Incidentally a special error number, so that the traffic record application to hear the error, compare the error code, you can do the processing!

The author through 8 machine, which has been continuously tested for nearly the hours and found 8 Machine is still working, there is no black screen problem! At the same time, I also looked at one of the 5 of the system printing, indeed there have been a select timeout problem! That means that our approach to treatment is still effective. Although not a very clever way, but it is a practical way !

Many times, we do not have so many resources, but also to do some things, of course, we need to think of some way!

Analysis and countermeasure of black screen for driving record application based on android4.4 system

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.