yashsingh1/xdaforums huggingface dataset:
[One (M9) General] Fikus011:
OK, I made a mistake, it's not the candy cam that has no problems, it's FV-5 cam that has no issues rear or front, and cinema FV - 5 even takes videos np, also just tried google cam and it craps out on front one, rear is fine.

With R32 candy cam causes the kernel panick on front cam, goes BSOD like it's f..n Windows.

Will test ONE+1 cam later on too.

I think with R31 or earlier that candy cam had no problems with front one, not really sure tho.
[One (M9) General] rockNme2349:
I'm not sure how much work has gone into the video crash already, but I'm going to try and take a look at it this week. (Turns out getting CM to build is quite a pain)

There's a few interesting things I found in my logs that I want to check out:

V/CameraWrapper(12199): camera_get_parameters->F55C87E0->EF00001C
V/CameraWrapper(12199): camera_get_parameters: original parameters:
V/CameraWrapper(12199): camera_put_parameters->F55C87E0->EF00001C
E/CameraSource(12199): Uknown color format (ae-bracket-hdr=Off;ae-bracket-hdr-values=Off,AE-Bracket;antibanding=off;antibanding-values=off,60hz,50hz,auto;auto-exposure=center-weighted;auto-exposure-lock=false;auto-exposure-lock-supported=true;auto-exposure-values=frame-average,center-weighted,spot-metering,center-weighted,spot-metering-adv,center-weighted-adv;auto-hdr-enable=disable;auto-hdr-supported=true;auto-whitebalance-lock=false;auto-whitebalance-lock-supported=true;avtimer=disable;awb-calibration-check=success;brightness-step=1;camera-mode=0;capture-burst-interval=1;capture-burst-queue-depth=2;capture-burst-retroactive=2;cds-mode=on;cds-mode-values=off,on,auto;contiburst-support-mode=take;contrast=5;contrast-step=1;current-focus-step=541;denoise=denoise-on;denoise-values=denoise-off,denoise-on;dis=disable;dis-values=enable,disable;dng-raw-supported=true;dual-camera-supported=true;effect=none;effect-values=none,mono,negative,solarize,sepia,posterize,whiteboard,blackboard,aqua,emboss,sketch,neon;enable-dual-lens=true;exp osure
F/CameraSource(12199): frameworks/av/media/libstagefright/CameraSource.cpp:145 CHECK(!"Unknown color format") failed.

The Unknown color format error should be coming from this line: github.com/CyanogenMod/android_frameworks_av/blob/cm-12.1/media/libstagefright/CameraSource.cpp#L142 For whatever reason, it seems the entire flattened params map was passed into the getColorFormat function. I'm going to try and build a version that will dump a stack trace so I can figure out what's going on.

On top of that, the camera_get_parameters: original parameters: log entry is strange as well. That should be coming from github.com/CandyDevices/device_htc_hima-common/blob/c5.1/camera/CameraWrapper.cpp#L345 but the dump that is supposed to follow is absent.

It makes me think that there's something going wrong with the code that is suppose to parse the camera parameters from the device.
[One (M9) General] dlads:
Ok so i have the video camera now working.

Using SNAP Camera (i told you to give it a whirl ;) )

I have the paid for version of this app.

Open the app (normal camera works) Click menu, other, scroll down to Open GLES 2.0 and Use Camera2 API, turn them both on, video now works.

Happy days.

This is with the Candy rom.

Definitely working as expected.recorded some videos no problem.
[One (M9) General] AtibaQ:
You are a legend I can confirm this is working on Slim LP I only done a little 10 second video test but it works. Thanks
[One (M9) General] djsubtronic:
Lol, I tried literally every setting combination EXCEPT Camera 2 API (as this only works in legacy mode and loses a lot of the photo functions like denoise etc). Well done! I can live without the photo enhancements if it means I can continue using video recording with my regular camera app.
[One (M9) General] RoganTheTwat:
Is there anyway to get facial recognition turned off snap cam? It could potentially be the go to app if so.
[One (M9) General] dzo:
There's a setting in the "Photo" menu for face detection, it's off by default.
[One (M9) General] RoganTheTwat:
Still crashes for me, cant find the facial recognition option :(
[One (M9) General] dlads:
Crashes on front camera for sure
[One (M9) General] chadouming:
I tried to bypass the Unknown color format error by manually forcing a pixel format. This changed nothing. I'll try to get a little more from parameters dump.
[One (M9) General] rockNme2349:
That's good to know. Currently I'm still working on just getting the source to build. I'm working through compile errors as they come, and it's currently still plodding along. (Thank god I have a headless machine that can keep itself occupied with this.)

Based on what you discovered, I'd guess that none of the parameters are being filled in correctly, and the color format just happened to be the first error that occurred. I'd be curious what's in that dump. It might be worthwhile to try and print out the raw parameters string from the device, as captured here: github.com/CandyDevices/device_htc_hima-common/blob/c5.1/camera/CameraWrapper.cpp#L340 Might turn up something obvious that is screwing up the params.unflatten call.
[One (M9) General] chadouming:
Had a cyanogenmod tree but i have errors with app crashing for no reason when i use custom build for it. Currently sync'ing candy rom sources. I'll give you news this evening if I can get to log the parameters string. You can tell me if there is anything else you want me to try.
[One (M9) General] rockNme2349:
Thanks again. I finally got a build to complete, but when flashed I got stuck at the boot animation. I was hoping to stay as far upstream as possible, but since Candy is working I'm just going to rebuild on their sources. I suppose the patch will make it back up one way or another. I'll have to see if that ccache pays off.
[One (M9) General] chadouming:
Build started. I added :

ALOGV("flattened string : %s", String8(parameters));

to the camera wrapper, hoping we'll see what it's in there. If you want i'll share you the build once it's ready.
[One (M9) General] Rashed97:
http://review.cyanogenmod.org/#/c/109728/ disables the face detection on the rear camera, it's still crashing on the front camera though.

Hmm, sounds promising, I'll see if we can implement that in the wrapper so it automatically does it.
[One (M9) General] djsubtronic:
Just FYI, enabling Camera2 comes at the cost of losing a LOT of still image features such as denoise, colour/saturation settings, zero shutter lag, etc etc (since the M9 doesn't have full Camera2 support - unless that can be enabled as well?). If you do find a way of implementing a Camera2 fix for videos into the wrapper, try to do in a way that it only does so for video, not for stills as well. If that makes sense???
[One (M9) General] dlads:
I think the api is all is needed.
[One (M9) General] djsubtronic:
That would be good, assuming there are no hardware features necessary for the API to work.
[One (M9) General] Rashed97:
The M9 HAL is done in an interesting way. It uses camera2 but its using the legacy mode of camera2, where a lot of features aren't enabled.
[One (M9) General] defcomg:
what happens when you add this line to build .prop

persist.camera.HAL3.enabled=1

on lolipop seems to return camera2 in full mode but something happens with the preview
[One (M9) General] djsubtronic:
Yeah, that's what I mean. Is it possible to enable full Camera2, or is it hardware dependant?
[One (M9) General] dlads:
I mean simply to get it to work, without the features, snap camera obviously has something that the normal camera does not, so what i'm saying is, take that and then work the rest out as we go on.

Or to the that effect.

As it stands i'm simply using Snap Camera, 1080p works and besides a few glitches here and there it's as good as i need it to be. :)

---------- Post added at 04:41 PM ---------- Previous post was at 04:40 PM ----------
[One (M9) General] wickedmx:
Just gave this a whirl and it works perfectly for my video needs. Thanks for pointing out the options to adjust. I'm still using Camera FV5 for photos as that is working really well for me, but I'll use Snap Camera for video thanks to your advice and experimentation.

EDIT

I've just looked through the settings of Cinema FV5 and realised I can get focused, usable video by adjusting the following options under general camcorder settings:

Focus before capturing - disable

Allow capturing videos without focus - enable
[One (M9) General] dlads:
You're more than welcome mate and thanks for pointing that out too. :)
[One (M9) General] jerkywez:
Good work guys

Good work on this so far guys, we are all rooting for ya :D
[One (M9) General] chadouming:
TRying to revive an old thread here, but I dropped the parameters string and I have about the same as you, but with a little more.

ae-bracket-hdr=Off;ae-bracket-hdr-values=Off,AE-Bracket;antibanding=off;antibanding-values=off,60hz,50hz,auto;auto-exposure=center-weighted;auto-exposure-lock=false;auto-exposure-lock-supported=true;auto-exposure-values=frame-average,center-weighted,spot-metering,center-weighted,spot-metering-adv,center-weighted-adv;auto-hdr-enable=disable;auto-hdr-supported=true;auto-whitebalance-lock=false;auto-whitebalance-lock-supported=true;avtimer=disable;awb-calibration-check=success;brightness-step=1;camera-mode=0;capture-burst-interval=1;capture-burst-queue-depth=2;capture-burst-retroactive=2;cds-mode=on;cds-mode-values=off,on,auto;contiburst-support-mode=take;contrast=5;contrast-step=1;denoise=denoise-on;denoise-values=denoise-off,denoise-on;dis=disable;dis-values=enable,disable;dng-raw-supported=true;dual-camera-supported=true;effect=none;effect-values=none,mono,negative,solarize,sepia,posterize,whiteboard,blackboard,aqua,emboss,sketch,neon;enable-dual-lens=true;exposure=0;exposure-compensation=

I believe we are not getting the full string. Seems to be missing a lot of parameters.
[One (M9) General] EvoGuy2010:
Honestly the camera's like the only thing that's keeping me from flashing the cm 12. Really wish this gets fixed completely. The last AOSP camera for cm worked with pictures but videos... no cigar.

---------- Post added at 05:11 AM ---------- Previous post was at 04:46 AM ----------

Also, yall do realize there's a temporary fix to the camera, right?

Just get Snap Camera (premium version) either payed or just apk.

Open the app, go to other, then scroll down and switch on OpenGLES 2.0 and Camera2 API.

Video runs smooth, camera working great.

IDK why but we could learn from this setting thing cuz it works . If face detection works then it's two birds with one stone!
[One (M9) General] blackknightavalon:
Rear camera on dr.sn0w's builds actually works. It's the front camera that's failing.

Sent from my toaster
[One (M9) General] rockNme2349:
Sorry I haven't posted back here in a while. This is an incredibly bizarre bug that seems to defy capture.

So what I have been able to determine is that `mCamera->getParameters()` is returning a well-formed string that contains all of the camera parameters. The problem with the log is that it is truncated after a certain length, which is why it appears parameters are missing. I've uploaded a full dump of the parameters list here if you need it: http://pastebin.com/NLXuZ9gV. Notably present is the line: Adding video-frame-format: yuv420sp

As far as I can tell, there is some memory allocation problem in the mMap object, but I find this incredibly hard to believe, since KeyedVector is a common android class.

A big pain point for me is that I can't get log messages to print from the CameraParameters.cpp file. It's made it incredibly difficult to try and figure out what's going on inside of it. If anyone can offer any advice on this it would be well received. I'm not very well versed in the android logging system. I've included these lines at the very start of the file, but to no avail:

#define LOG_NDEBUG 0
#define LOG_TAG "CameraParameters"
#include <cutils/log.h>

I can only assume that there are some flags in the makefile or something that are blocking me. If anyone can offer guidance here, it would be really helpful.

As far as the Snap Camera goes, it's definitely a helpful workaround, but besides the AOSP camera app, there are plenty of other apps that access the camera using the original Camera API, so we really do need to get that fixed.
[One (M9) General] rockNme2349:
Good news everyone!

I've managed to get working video! Face detection still crashes, but I'll be looking at that next. I opened a pull request with CandyRoms here: https://github.com/CandyRoms/frameworks_av/pull/5

If anyone here is building their own images, I'd appreciate some verification that this fixes the issue on other devices.
[One (M9) General] rc420head:
Running build now for gsm, if Allgood I'll merge it, cheers

Edit: video still makes camera fc

Log https://copy.com/AIuhx4ZfqK2ALooV

------------------------------------

CandySiX coming soon
[One (M9) General] rockNme2349:
OK, ugh. I just finished my clean build, and it didn't work for me either. It appears there is more going on here. I had lots of other debugging changes in my tree, and slowly started backing them out and determined that this was the necessary change. Unfortunately it looks like the make process was caching whatever change had actually fixed the problem. It's going to take a little bit of time to put back together the actual fix doing a clean build after each iteration, so you'll have to bear with me for a little bit here.

In the meantime, here's a teaser to prove that I'm not crazy: https://www.youtube.com/watch?v=co_u8Z_d-bY

If the current build works I'll upload the files somewhere as is in all their bastard glory so people can test on other devices while I get it cleaned up. Sorry for the premature pull request.
[One (M9) General] bacon612:
Nice work. Is 4k video working too or just 1080p like the camera 2 api in snap camera?
[One (M9) General] Rashed97:
4K is going to need work in the wrapper no matter what you do. The stock AOSP system just isn't ready to handle 4K yet (tho it might now in M)
[One (M9) General] rc420head:
its allgood , pm me your gmail address and ill add you to our google hangout
[One (M9) General] rockNme2349:
OK, I did another clean build back to where I was at, and video is working again. The following files have changes to them, in addition to the makefile from the pull request:

device/htc/hima-common/camera/CameraWrapper.cpp: http://pastebin.com/WwUtzjVh

Here all I did was remove some of the manipulation in the camera_get_parameters function just to take unknowns out of the equation. This can likely be reverted.

frameworks/av/camera/CameraParameters.cpp: http://pastebin.com/jbF2aw3K

frameworks/av/include/camera/CameraParameters.h: http://pastebin.com/XMRaBkz9

Here, since I kept getting crashes inside of the DefaultKeyedVector logic, I had taken it out of the equation, and replaced it with just an array, again in an effort to have one less thing to worry about. I didn't think this was the actual fix, but now I'm not so sure. If the actual bug is inside of the DefaultKeyedVector logic, we'll still have some more work ahead of us for a real fix. I also did some work on the constructor routines, which could have been the solution.

frameworks/av/include/media/stagefright/CameraSource.h: http://pastebin.com/3k7SCRrT

Looks like this was leftover from some other debugging in CameraSource.cpp. It shouldn't be used, but I'm including it here since I just did my build with it.

I'm going to start now with eliminating some of the extraneous changes, and hopefully narrow down where the actual fix is. If some developers want to apply these changes to their tree for testing purposes, it would help to have some more information. I'm only testing on the Verizon variant. At this point I'm going to try rebuilding with only the changes to CameraParameters, since I'm fairly sure that's where the actual bug is.
[One (M9) General] Rashed97:
I'll apply it to the CM12.1 tree later today and see if we can get rid of stuff or not. If worst comes to worst we can always just ifdef stuff out.
[One (M9) General] rockNme2349:
I'd encourage you to apply it for testing, but don't commit any changes yet. I know not all of this is necessary, and I want to strip out a lot of the debugging crap that's still in there. I'm working on this today, but it'll just take a bit of time since clean builds are required between each change. I'll keep you all apprised of my progress.
[One (M9) General] Rashed97:
That's why I'm going to upload it somewhere. Most of those stuff can probably be moved outside of frameworks/av so we don't pollute the main repos so I just want to see that.
[One (M9) General] rc420head:
I can Confirm working video.

https://github.com/CandyRoms/frameworks_av/commit/97dc708f1cb6cc8c8134011c46b6363aec7af7e6

https://github.com/CandyDevices/dev...mmit/c946ce5c1c14d033f72ba6861d57f4189f089250

Also I sent you Google hangouts request if you don't see it look under invites

------------------------------------

CandySiX coming soon
[One (M9) General] Ecsport108:
I would love to test a version of Candy5 with working video, also does the camera work in Snapchat?
[One (M9) General] rc420head:
I don't know yet, and all 3 will get new builds very soon.

Edit:Nope Snapchat fc

------------------------------------

CandySiX coming soon
[One (M9) General] Ecsport108:
Alright thanks for y'alls work, I really appreciate it! I will probably flash once the video fix is implemented, I used Candy5 on my One Mini (M4) and it was by far my favorite ROM. Do you think Snapchat force closes due to it own face detection software?
[One (M9) General] rc420head:
Yes

------------------------------------

CandySiX coming soon
[One (M9) General] rockNme2349:
FWIW, video in snapchat does work with this fix, but as rc420head said, the front facing camera crashes on face detection.
[One (M9) General] Rashed97:
HTC blobs are weird, we're working on hacking that right now.
[One (M9) General] Ecsport108:
Could I potentially just awkwardly take selfies with the rear camera to get around this until face recognition is solved?
[One (M9) General] Andrewbud:
Or just not take them at all. You can annoy people with pictures of your dinner instead.
[One (M9) General] Ecsport108:
Very valid point, I will keep that in mind.
[One (M9) General] rockNme2349:
You can, but just hope that no one walks in on you during this process.
[One (M9) General] djsubtronic:
Don't forget the old school mirror selfie.
[One (M9) General] Ecsport108:
Oh damn, bringing it back! I didn't even think of that!
[One (M9) General] bacon612:
OK guys. It looks like we have all of the issues cleared up and we are ready to award the bounty. The front camera FC was the last issue and its now fixed. I need a little time to sort out how this is going to go down as there is more than one dev that is responsible for the fixes. I just wanted to post this as a heads up that if you pledged, your moment to make good on that promise is coming soon. These devs were gracious enough to share the fixes with the community as they were available which in my opinion commendable.

Please check back here soon for further instructions.
[One (M9) General] Rashed97:
For anyone wanting test builds of just normal CM as proof of the working cameras, I'll be running those tomorrow (I have an exam and paper I have to focus on for the next few hours though) and I'll be posting them somewhere, with a link here of course. And yes all 3 variants will be included in the builds.
[One (M9) General] Andrewbud:
Awesome guys. Great work .
[One (M9) General] computerslayer:
To be clear, does this include the face issue too? I ask because this was being discussed here recently without a clear indication (well, besides your latest post!) that it was also solved.

On a different note altogether, is it too late to add $50 to the bounty? My hope is better late than never.
[One (M9) General] mhajii210:
Face detection

Guys is face detection working now? Now if you'd fix the speakerphone problems I'm having on Candy5 I'd be set! Great work guys!!
[One (M9) General] bacon612:
Not too late to contribute. The face detection crash on the front facing cam is now fixed, yes. Was fixed yesterday and you should see it soon in candy5.
[One (M9) General] bacon612:
Please post in the Candy5 thread for help with your speakerphone. Was fixed a while back. Been working great for me on my T-Mobile M9
[One (M9) General] da5hi30i2d:
Is there a current download link for the up to-date fix?
[One (M9) General] bacon612:
OK guys. There are four devs whos efforts are responsible for the camera fix. We have decided to send the bounty to my paypal address which is adam@logidac.net. Once i receive the funds, I will divide and pay out to the four devs. For the user that wanted to pay in BTC, ill edit this post later with my BTC info. As your pledges come in, i will note the OP so that I wont have to unleash the Android gremlin on you.

The four devs responsible for the fix in no particular order are as follows:

[MENTION=1792279]ivicask[/MENTION]

[MENTION=5066258]rc420head[/MENTION]

[MENTION=4662457]Rashed97[/MENTION]

[MENTION=4324408]rockNme2349[/MENTION]

These guys are heros in my mind and will be sharing the bounty. Please take the time to throw them a thumbs up if you see them around here.

Remember to send the funds in USD via PayPal as the OP stated. ALSO, PLEASE INCLUDE YOUR XDA HANDLE SO I KNOW WHO YOU ARE. Any questions, send me a PM. Thank you to all pledges for your contributions on behalf of the devs.
[One (M9) General] bacon612:
Not yet. Look in candy thread sometime soon.
[One (M9) General] rc420head:
I'll be running candy builds very soon and will post links to them.

------------------------------------

CandySiX coming soon
[One (M9) General] da5hi30i2d:
Kool!

Where is the download link to test out?
[One (M9) General] rc420head:
Working on it..... From work so bear with me

------------------------------------

CandySiX coming soon
[One (M9) General] chadouming:
Anywhere I can see the changes ? If it's not ready yet i'll wait.
[One (M9) General] rc420head:
It's a few commits, look on CandyRoms , CandyDevices and the Muppets. Note some are still pull requests on candy. I'll push everything and make a list of what's needed after work.

Here is gsm, camera works, video works including 4k and Snapchat doesn't fc. Run it though the passes and let me know if any apps you guys use fc. http://downloads.codefi.re/cnexus/rc420head/m9/candy5-release.v4.0-20151022-OFFICIAL-himaul.zip

------------------------------------

CandySiX coming soon
[One (M9) General] chadouming:
Cool, so basically we are just discarding face counts from blobs ?
[One (M9) General] rockNme2349:
That's right. As noted there, HTC must have rolled their own data structure for the faces, so we're simply discarding them. We could likely re-enable face detection if we get a working library built from source, or if the new HTC blobs are more AOSP compliant.
[One (M9) General] Jhonys:
May I ask if this is a proper fix or a 'hack'? I mean, is the fix something we can use for later version, i.e. android M?
[One (M9) General] DroidShift79:
Yeah, that's what I'm wondering, too.

Maybe M build for the m9 bring different blobs and the hussle starts all over again
[One (M9) General] irocevo:
Are these the same fixes?

http://review.cyanogenmod.org/#/c/114154/

http://review.cyanogenmod.org/#/c/114153/

http://review.cyanogenmod.org/#/c/112379/

http://review.cyanogenmod.org/#/c/109728/

I used these in my crdroid build for sprint version of m9 and everything is working.

I paid either way just want to make sure that these are the correct ones. :)

I wish someone would help us sprint users with activation problem when flashing cm :(
[One (M9) General] mhajii210:
Bounty

I just sent $110 via PayPal. I will be testing the front facing camera that was crashing previously later. Great work guys! Hopefully we don't have to start all over again with Marshmallow. :good:
[One (M9) General] rc420head:
Need this one too for face detection fc

https://github.com/armills/frameworks_base/commit/3cb1a7ea34b4d0b9ccd1f59b7de6bcde7c2c07e6

------------------------------------

CandySiX coming soon
[One (M9) General] racerboy3801:
Thank you everyone that helped to make this possible. It's awesome to be able to use my phone as I want to!!!