Identify CM7 HD Recording issue and need help to modify libcameraservice.so

Search This thread

hhcat

Member
Dec 30, 2011
41
59
This post is better to be in xt720 Dev board. But it is a pity that I don't have the privilege to post in that board now. So anybody who kindly help forward to the dev board would be great appreicated.
For quite a long time, we sufferred to HD record issue in CM7. And I spent some days inveistigaing this issue and fortunatelly got some interesting findings to share.

1. 720p HD recording fail becasue of wrong width and height parameter pass to function createOverlay in libsurfaceflinger.so.
02-13 17:38:12.030: D/TIOverlay(1876): overlay_createOverlay:IN w=768 h=432 format=99
02-13 17:38:12.030: I/Overlay(1876): v4l2_overlay_init:: w=480 h=854
02-13 17:38:12.030: I/Overlay(1876): v4l2_overlay_init:: w=768 h=432
02-13 17:38:12.030: I/Overlay(1876): v4l2_overlay_init:: w=768 h=432
Here we see, the paramter passed to createOverly is (768,432). And in comparison with 2.2 stocked Rom, the right parameter should be (1280,720) for HD recording.

2. The wrong width/height parameter is set in libcameraservice.so. Perhaps CM7 forbids HD recording...
02-13 17:38:12.030: D/CameraService(1540): Changing overlay dimensions to 768X432 for 720p recording.
And double check by open libcameraservice.so, we found the matched words in the above at the address of 0x000ae00h. The very possible guess is CM7's libcameraservice.so check width/height parameter, whenever it detect the parameters are for HD record, it reset the paramter to (768,432)!!

Proposed solution:
If someone could kindly help modify the code to comment the piece of code and build a new libcameraservice.so, we may have chance to bring HD recording back.
 
Last edited:

Zachary57

Senior Member
Feb 2, 2011
581
134
I forwarded into developpement thread but I don't know if it is the only problem because librairies from 2.1 to 2.2 and 2.3.
 

hhcat

Member
Dec 30, 2011
41
59
Great thanks!
libcameraservice.so is the current blocking issue I have identified. Certainly, there are possible some issues come out after we solved this one.
BTW, I've enabled 720p hardware video decoding in CM7. The phone could now play 720p video smoothly. This should be a good basie to fix HD recording issue.
 
  • Like
Reactions: B_e_n and peshovec

Mioze7Ae

Retired Recognized Developer
Dec 27, 2010
2,153
2,053
Queen City of the West
Google Pixel 7
Interesting. I don't have much to say about this at the moment, but for now I can point you into the source (Line 767):

https://github.com/CyanogenModXT720...ces/camera/libcameraservice/CameraService.cpp

These commits seem relevant (from the "blame" view):
https://github.com/CyanogenModXT720...mmit/a930c3c872cf6eaa57bfdddc923132cf0d48564b
https://github.com/CyanogenModXT720...mmit/cf997d0147228ece729ceb95745d20905664426d

Edit: So, it looks like to set the overlay size to whatever we want, we just change line 74 of CameraService.cpp to put the desired resolution. The other part of the puzzle is to adjust media_profiles.xml to add the HD profile. I had done that in the past by copying settings from decompiled MotoCamera, but the screen would go black and get weird or cause a reboot when the camcorder was switched to HD. I think your finding about the overlay resolution might explain why.

FYI: *Temporarily*, I don't have access to an XT720 (due to a laundry incident that took out both my second XT720 and my wife's Nexus S--so she's using my primary XT720 and I'm luddite mode until we sort out what to do about her phone--surprisingly they both may have survived--they power on, the XT720 boots all the way but no touch (when the screen is on you can see some streaking under the screen so I think possibly some residual moisture is interfering with capacitance so I'm going to let it dry some more--I tore a different XT720 into tiny pieces recently and there's a whole stack of paper-like pieces under the screen and I think they're still somewhat wet) and the NS turns on but get's stuck at the Google logo even when trying to enter recovery so I think it needs to be reloaded, I've only made it as far as fastboot mode on that one due to only having a power-only usb cable handy at the time).
 
Last edited:

peshovec

Senior Member
Nov 11, 2010
305
343
what you mean by 720p playback?

i have tested with youtube videos (searched for 1080p hd :)

what other test can be made?


btw, hope you will be able soon to post in the devel section
 

hhcat

Member
Dec 30, 2011
41
59
Hi peshovec, I also read your reply in dev board.
As you got the same finding and have already fixed the code, could you please share the new built libcameraservice.so? I don't have CM7 source code at hand, and it will take me several days to sync. Last month, I spent near two weeks to sync CM9 code ...
And one important thing, we might need to keep libcameraswervice.so compatible with old 2.2 driver libcamera.so. libcameraservice.so from other 2.3 Rom contains a new function "_HAL_Camerainfo" ( sorry, did not remember clearly) that does not implemented in old libcamera.so. The trick I saw in the code is to "#define BOARD_USE_FROYO_LIBCAMERA".
I am quite interested to follow-up on this HD record issue with all of you help!
 

hhcat

Member
Dec 30, 2011
41
59
And for 720p playback, I mean to hardware decode some 720p video.
Xt720's CPU is able to support h264 baseline profile, but could not support H264 high profile. So I am afraid for 1080p video and H264 high profile 720p on youtube, our phone still could not play with hardware decode.
The trick to fix 720p hardware decode is to use old xt720 2.1's codec: lib\hw\*, and libOMX.TI.*. The existed libOMX.TI.720P.Decode.so in CM7 support other phones (e.g. Defy) well, but not support xt720.
I tested my phone after the fix of 720p HW decode with one 720p video, and found my phone could play the video smoothly with either Moboplayer or Moto Videoplayer. And before the fix, the playback could only use SW decode, and even overclock to 1GHz, the pictures was still lag behind of voice.
 
  • Like
Reactions: Mioze7Ae

hhcat

Member
Dec 30, 2011
41
59
Hi Mioze7Ae, I also did investigations on media_profiles.xml and build.prop.
Acutually, stocked 2.2 xt720 Rom is not necessarily to rely on those settings in either media_profiles.xml or build.prop. As you observed, all resolution parameter was set in Camera.apk. I tested xt720 2.2 Rom without media_profiles.xml and none of related settings in build.prop, 720p HD video still work fine. And for xt711 phone, it even don't have media_profiles.xml in the official Rom.
Ah, 5 post now. Still need 5 other post ...
 
  • Like
Reactions: Mioze7Ae

peshovec

Senior Member
Nov 11, 2010
305
343
Hi peshovec, I also read your reply in dev board.
As you got the same finding and have already fixed the code, could you please share the new built libcameraservice.so? I don't have CM7 source code at hand, and it will take me several days to sync. Last month, I spent near two weeks to sync CM9 code ...
And one important thing, we might need to keep libcameraswervice.so compatible with old 2.2 driver libcamera.so. libcameraservice.so from other 2.3 Rom contains a new function "_HAL_Camerainfo" ( sorry, did not remember clearly) that does not implemented in old libcamera.so. The trick I saw in the code is to "#define BOARD_USE_FROYO_LIBCAMERA".
I am quite interested to follow-up on this HD record issue with all of you help!

here is it (attachment)
also here is the mediaprofile.xml (which i use), with high and wide working
https://github.com/CyanogenModXT720...la_sholest/blob/pesh-modif/media_profiles.xml

can you try to search in youtube for 1080p hd videos and try to play some of them? i am curious if they will play on your setup (`couse in my test build i am able to play them...)
 

Attachments

  • libcameraservice.zip
    19.4 KB · Views: 11
  • Like
Reactions: 3rdstring

hhcat

Member
Dec 30, 2011
41
59
Thanks for the attachment! I will have try and give update later.
I tried to play some H264 high profile video: voice only and no pictures.
xt720's CPU fail to HW decode thoese video.
The workaround solution is to download the video, then we could choose SW decode in mediaplayer ( I used moboplayer). But the video play is very terrible, the picture play frame by frame, even though I have overclock to 1GHz.
 
  • Like
Reactions: Mioze7Ae

hhcat

Member
Dec 30, 2011
41
59
Haha, the quick update is HD 720p recording preview work fine! Verly clearly and smoothly view from preview window!!
On the way home now, will do some more tests later.

Mark: 9 post now :)
 
  • Like
Reactions: Mioze7Ae

hhcat

Member
Dec 30, 2011
41
59
Yeah, 720p HD recording is perfectly fixed!
Now we could enjoy HD recording in CM7!
BTW, I didn't tested your media_profile.xml. Now I used the one in 2.2 stocked ROM.
10 post now, heihei...
I will packed my Rom and share in Dev board tomorrow.
 

fjfalcon

Retired Recognized Developer
Jan 19, 2011
844
1,263
Schelkovo
omg, lol, so can someone confirm that hd video really work on any cm7 ? =)

well, afaik good that you have fixed preview.
Problem now in hd encoder...
Well.. we don't have it.
 
Last edited:

peshovec

Senior Member
Nov 11, 2010
305
343
my fast testing doesn't seems good...

preview ok, but can't focus well (after try-ing to focus, the focus is set to the minimum distance), recording seems to start, preview display freeze. some file is generated trough.....

but that should be just my setup (is motoroi with the moto froyo able to record 1280x720p ? , if yes we can find way*)



p.s. *remark. in my opinion 1280x720 recording is just marketing, also it is not job for the phone to record at this resolution, working wide 848x480 is more than enough...
 

hhcat

Member
Dec 30, 2011
41
59
My phone is able to HD recorde in 2.1 and and 2.2 Rom, but lose this ablity when upgrade to CM7 2.3 Rom.
Not sure whether our phone have some HW difference.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    This post is better to be in xt720 Dev board. But it is a pity that I don't have the privilege to post in that board now. So anybody who kindly help forward to the dev board would be great appreicated.
    For quite a long time, we sufferred to HD record issue in CM7. And I spent some days inveistigaing this issue and fortunatelly got some interesting findings to share.

    1. 720p HD recording fail becasue of wrong width and height parameter pass to function createOverlay in libsurfaceflinger.so.
    02-13 17:38:12.030: D/TIOverlay(1876): overlay_createOverlay:IN w=768 h=432 format=99
    02-13 17:38:12.030: I/Overlay(1876): v4l2_overlay_init:: w=480 h=854
    02-13 17:38:12.030: I/Overlay(1876): v4l2_overlay_init:: w=768 h=432
    02-13 17:38:12.030: I/Overlay(1876): v4l2_overlay_init:: w=768 h=432
    Here we see, the paramter passed to createOverly is (768,432). And in comparison with 2.2 stocked Rom, the right parameter should be (1280,720) for HD recording.

    2. The wrong width/height parameter is set in libcameraservice.so. Perhaps CM7 forbids HD recording...
    02-13 17:38:12.030: D/CameraService(1540): Changing overlay dimensions to 768X432 for 720p recording.
    And double check by open libcameraservice.so, we found the matched words in the above at the address of 0x000ae00h. The very possible guess is CM7's libcameraservice.so check width/height parameter, whenever it detect the parameters are for HD record, it reset the paramter to (768,432)!!

    Proposed solution:
    If someone could kindly help modify the code to comment the piece of code and build a new libcameraservice.so, we may have chance to bring HD recording back.
    3
    Yeah, 720p HD recording is perfectly fixed!
    Now we could enjoy HD recording in CM7!
    BTW, I didn't tested your media_profile.xml. Now I used the one in 2.2 stocked ROM.
    10 post now, heihei...
    I will packed my Rom and share in Dev board tomorrow.
    2
    Great thanks!
    libcameraservice.so is the current blocking issue I have identified. Certainly, there are possible some issues come out after we solved this one.
    BTW, I've enabled 720p hardware video decoding in CM7. The phone could now play 720p video smoothly. This should be a good basie to fix HD recording issue.
    1
    And for 720p playback, I mean to hardware decode some 720p video.
    Xt720's CPU is able to support h264 baseline profile, but could not support H264 high profile. So I am afraid for 1080p video and H264 high profile 720p on youtube, our phone still could not play with hardware decode.
    The trick to fix 720p hardware decode is to use old xt720 2.1's codec: lib\hw\*, and libOMX.TI.*. The existed libOMX.TI.720P.Decode.so in CM7 support other phones (e.g. Defy) well, but not support xt720.
    I tested my phone after the fix of 720p HW decode with one 720p video, and found my phone could play the video smoothly with either Moboplayer or Moto Videoplayer. And before the fix, the playback could only use SW decode, and even overclock to 1GHz, the pictures was still lag behind of voice.
    1
    I am uploading my Rom to DEV board.
    Have a try.