yashsingh1/xdaforums huggingface dataset:
[Samsung Captivate Glide] yohan4ws:
** I'd like if this thread was kept to ONLY contributing to the solution to the known issues, no asking for eta's feature requests in other ROM's **

Its been confirmed that the Audio issue is in the AudioLib's. So far numerous people have been swapping out libaudio's from different device trees has different results. Bluetooth hasn't been targeted yet - I personally believe that the hands free phone over bluetooth is connected to the libaudio.

************************************** EDIT *************************************

http://e2e.ti.com/support/embedded/android/f/509/p/198799/790457.aspx as found and posted here by lorddavid

The above link has some great insight to what the issue is, it talks about it being the sampling rate of the microphone and the speaker (input and output) being differnt. This is why the playback would change to slow motion .. It makes perfect sense! .. The only question now is how do we implement this into our ROMs to fix it ... I'm guessing there's an audio driver that needs to be modified from the source .. I haven't looked at the source code yet myself but following what was posted above into any of our roms with the audio issue may resolve.

Logcat confirms this :

********************************* UPDATE - AUDIO **************************

If you would like to test this patch by Adam77Root do a Nandroid backup first. It will get Skype working, however, it will start to use the back loudspeaker (think playing MP3's) for the regular cellular voice calls and for skype. The audio sampling rate is fixed in this patch but you'll be stuck with speakerphone type calls.

***************** UPDATE - BLUETOOTH *********************
[Samsung Captivate Glide] spitfire2425:
For bluetooth theres fixes in different forums because bluetooth has been a big problem for other devices with 4.2.2. Even the nexus 7 was having problems on custom roms.
[Samsung Captivate Glide] yohan4ws:
I guess a linux box needs to be setup to compile a new kernel... thegreatergood left a link to the sources somewhere, this I recall... What other device are similar to ours in terms of chipset etc? ... S2 ?
[Samsung Captivate Glide] santimaster2000:
Again, no, the S2 has Exynos while our phone has Tegra 2, if you're looking for the device that resembles the most of the glides specs, the Galaxy R it's the closest one I think :)
[Samsung Captivate Glide] lorddavid:
Maybe is ther any possibilitie to ask for some help in the galaxy r forum? maybe someone can give a look to our roms or give us some hints
[Samsung Captivate Glide] spyke555:
Source code for our kernel comes from google AOSP + the code supplied by Samsung here:

http://opensource.samsung.com/ (search for i927)

Samsung has only released ICS code and this is what has been applied against the JB source tree. If that's right or not I have no idea...

As for the sources for the kernels they are all in The-Covenant's github:

https://github.com/The-Covenant

The LiteKernel---Glide repository is thegreatergood's code and android_kernel_samsung_i927 is the source for The-Covenant's kernel.

I have built the LiteKernel source and have the environment setup here. I've just been concentrating on getting the ROM side of things down first. That's coming along well so if you guys can get some insight as to what needs to be changed in the kernel source I'm more than willing to give it a go.

I do own a glide so quick tests are really easy...
[Samsung Captivate Glide] taiber2000:
what about taking a look on the soruce for the kernel/rom form the offical cm10.1 for the i9103 who has the same tegra 2 chip?
[Samsung Captivate Glide] scotte9999:
Thanks for making this thread yohan.

I'm not convinced it's a kernel issue though. Maybe a first step would be to get logcats and dmesg from a working ICS system and a non-working CM10.1 or similar system? IMHO important points would be logs during boot, during HSP pairing, and during call initiation.

I can take doing the ICS logs this weekend (wife's phone is on ICS), if somebody can do the equivalent with JB.
[Samsung Captivate Glide] yohan4ws:
Spyke can you point me in the direction of how to setup the build environment for the kernel source ? First thing I'm going to do is follow dmans how to compile and dl thee kernel sources thx for that info and the above.. I can post logcats and dmesg no problem from both...
[Samsung Captivate Glide] spitfire2425:
Has anyone tried the Bluetooth fix for other devices?
[Samsung Captivate Glide] spyke555:
Which kernel you looking to build?

There are two source trees you can start from:

https://github.com/The-Covenant/LiteKernel---Glide/

or

https://github.com/The-Covenant/android_kernel_samsung_i927

I've figured out the Lite-Kernel so far. You follow dman's guide up to the point of the source downloads. Here you just need the kernel source, nothing else. Once that's done you also want to install Linaro for your distro, and then adjust the Build4.X/Build KERNEL.sh files with the path to your Linaro install. After that just go into the correct Build folder and run the Build KERNEL.sh file and you should end up with a flashable kernel.

I've not done The-Covenant kernel at all yet so can't comment there.

I have also done a AOSP + Samsung sources build for ICS in the past, so that may be a good place to start so you can compare the working sources to the other two trees.

Let me know if you need more details and I'll guide you through it.
[Samsung Captivate Glide] jzamoras:
sorry to bother, but which custom roms does have BT headset working? thx!
[Samsung Captivate Glide] scotte9999:
I have The-Covenant kernel running (and a current CM 10.1 userland), but I'm having general audio input issues. Was going to debug the Bluetooth stuff, but running anything requiring audio input hangs.

Logcat shows "AudioHardware: cannot open pcm_in driver: cannot set hw params: Invalid argument". Not very descriptive.

This seems kind of ALSA related. Do you see this with your LiteKernel builds?
[Samsung Captivate Glide] lorddavid:
I search a little about that error, and found this

http://e2e.ti.com/support/embedded/android/f/509/p/198799/790457.aspx

http://xdaforums.com/showthread.php?t=1748873

Maybe help a little. Do you think that all the audio issue (bluetooth, skype, sound recorder, etc) is for the same problem?
[Samsung Captivate Glide] yohan4ws:
Great search, I'm willing to bet that this is the issue right here - audio sampling rate different between input and output. Everything makes sense.

Just have to dig in further now and compare source codes... anyone have the setup and feel like taking a stab at it ? I haven't had a chance to setup an ubuntu VM yet.
[Samsung Captivate Glide] yohan4ws:
epsalmond PM'd me this info ...
[Samsung Captivate Glide] santimaster2000:
So, that means all the issues may be related ? BT, Audio Recording with default Camera App and Skype/Anyothervoipapp ? If epsalmond it's right, that will mean that we only need to find one solution to solve all the problems, and then boom ! Fully functional JB on the Glide, that means that anybody with the knowledge to compile a ROM will be able to take all the "Unsupported" ROM's like PAC, PA, LS, SL, Vanilla RootBox, and incorporate the "FIX" on them, damn, that would be nice :)
[Samsung Captivate Glide] yohan4ws:
I believe so, think about it .... The audio only slows down when the microphone is enabled ... Video Camera .. Skype ... Bluetooth .

Because its a sound issue, it also means its a kernel issue (corrected me if I'm wrong) ... so an updated Kernel will resolve the issues across all ROMs should this be correct.

I have built up an Ubuntu box now and a build environment... I have no frikin idea what I'm doing but I know that I need to find the source for the audio driver ... I believe I found it here :: https://github.com/CyanogenMod/android_device_samsung_i927/tree/jellybean/libaudio

I think that there is a variable set somewhere to the sampling rate and there will be multiple area's that need to be looked at in order to fix the input sampling rate.

Once this is fixed, the only real things left are Torch from the toggles ....picture orientation, and that some apps disappear on reboot unless they're "moved to SD"... and battery too, I guess...
[Samsung Captivate Glide] bubor:
other kernel

Hello,

Build kernel from https://github.com/CyanogenMod/android_kernel_samsung_n1 with our config, but still broken bt audio.

Installed official cm10.1 and PACman 20.1.0 build for galaxy r with litekernel, but broken bt audio too.
[Samsung Captivate Glide] lorddavid:
Maybe is not only kernel. Adam say in his thread, that he thinks that know what can be the issue, but never say anything more :/
[Samsung Captivate Glide] yohan4ws:
Bubor. What did you change in the kernel ?

I asked Spyke to try these changes in his next CM10.1 build ...

============

I was looking through Adam77root's GalaxyR changelog on github ...

https://github.com/Adam77Root/andro...mmit/11d995fcc7666fda0a9012bc87bc04de85794668

Under libaudio/AudioHardware.h emade the changes from 8000khz to 441000khz for the sample rate... I really truly believe this will fix it..

Anything in green is what he modified/added, anything red is what he removed.

There's also under configs/audio_policy.conf that was added.. I'm not a coder but I've done some reverse engineering to troubleshoot stuff before.

If this is the fix and we get audio working, we MUST ensure we give credit to him.
[Samsung Captivate Glide] lorddavid:
I hope that fix the problem, in the changelog the data usage was fix too, so, maybe we get a lot of the problems fixed if we compare the code. But i dont know enough of android to do this :(

Edit: And if we ask for some help to Adam? we really need a developer to help us a little
[Samsung Captivate Glide] bubor:
Already in dman's device's repository. Just look at https://github.com/The-Covenant/android_device_samsung_i927 I think he uses that for M3 build.

That might be interesting:

# We have a Broadcom bluetooth device, but this is used only for building brcm_patchram_plus. We use the proprietary binary.

#BOARD_HAVE_BLUETOOTH_BCM := true

You can try cm10.1 for galaxy-r, flash lite kernel on it, it will work (partial), wifi could fix, but bt and phone will work instantly, you can try bt audio. It doesnt work for me, so I dont think same settings will fix it, I will compare mine build settings.
[Samsung Captivate Glide] yohan4ws:
Bubor, I'm focusing on Audio (Skype, Microphone, GoogleVoice etc.) Bluetooth HSP will also start working once we get the audio fixed.

Bluetooth - if it isn't working in 10.1 M2/M3 at all (even for linking audio output) will be the next one.

I think there's still some bad blood between Adam77root and this forum from a dispute Dman had a while back.. it had to do with a release coming out and somebody into getting credit - if you want details you can PM but its long overdue and doesn't matter.

I'd really like to see us try to get it going on our own, Adam doesn't own the glide any longer ....

I think its really a matter of going into the source folders of our Linux build environments, modifying the.h an creating an image to write to our device, if it works awesome...

Truthfully, I think we can grab the entire source file from Adam77root device tree, plunk it into our i927 source folders and build without issue...

These are just idea's, until I spend another couple hours getting my ubuntu box up and running and building images and learning how to update source etc. I can't hands on test.
[Samsung Captivate Glide] soadzoor:
I had a conversation with him about a week ago. He sad something like "I'm pretty sure the issue is somewhere in the audio libs, but I have no further idea".

I've just sent him a mail asking if he has any new ideas at the moment
[Samsung Captivate Glide] bubor:
@yohan4ws

would you show a guide how to test? I only use a bt headset. I dont use skype at all ;) Simply skype voice chat broken?
[Samsung Captivate Glide] soadzoor:
Let me get this straight. you flashed a galaxy R rom on your glide?

yea, skype voice chat broken, you hear distorted, low-sound when someone talks to you
[Samsung Captivate Glide] yohan4ws:
open terminal

cd ~/CM10.1

find . |grep Audio

pico ..... path to AudioHardware.h and insert the changes that Adam77Root made OR ..

Use firefox, goto github, download the modified AudioHardware.h and copy it into the folder overwrite our current one and then build.

If these instructions don't make sense I can't help you further because there's too much learning for me to explain. I'm an IT tech, my linux experience comes from learning and building slackware environments from the ground up as a teenager years ago when I downloaded like 30 floppy disk equivalents to get it going ... This included making my own Kernel for the workstation I was using. All the hardware drivers are included in the kernel.... This is the only experience I am going on, this is even borderline my level of knowledge because it is modifying the source code to hardware drivers - programming especially for drivers I know nothing about.
[Samsung Captivate Glide] bubor:
You misunderstand me, I asked something I could test audio work on the phone. I use music player and it works, so could you details what wrong? Could you write down how to reproduce it?

I can build a cm10.1 release with that libaudio, you can test it, or you can say how I could. (in fact it's completed )
[Samsung Captivate Glide] yohan4ws:
Oh ok.. Record a video using the stock camera, if there's sound in it ... then its fixed, if there isnt .. it isn't.

Download and installs skype, sign in, do the audio test call in the program.. it will reproduce the error. As soon as the microphone is activated in any app , the soundoutput will slow down.

So a microphone search in Google Now or Google Search ... it'll chime, so for example I'd say "Calgary weather in Celcius" it would tell me in slooow motion speech.

---

I also 2nd the above question, did you compile the GalaxyR and flash it to your device? I wonder what that would yield for changes..
[Samsung Captivate Glide] scotte9999:
I think the more relevant idea would be to diff LiteKernel 4.0 (ICS) with the changes made in the GalaxyR branch, and see if there's anything obvious there. As was already stated, the changes in the GalaxyR repository (thanks for finding that, btw!) are already in The-Covenant (and CM10.1) source, so it's not one of those changes.

To the question of how to test...I think initiating a call when the SCO connection to the BT headset would be sufficient - either you hear static/silence, or you hear something that doesn't seem random. :)
[Samsung Captivate Glide] Adam77Root:
soadzoor brought this thread into my attention.

@yohan4ws: Check libaudio here: https://github.com/CyanogenMod/android_device_samsung_i9103 The one in my repo is outdated a bit and there must have been some modifications I don't remember.

I've recently tried SGS2 libaudio with some modifications and Skype works! However, there are many problems with normal recording and sound playing. It seems it cannot set audio routing correctly. Calls work fine.

Conclusion: Skype bug is in libaudio, not in the kernel.
[Samsung Captivate Glide] yohan4ws:
Adam: Thanks for joining the discussion, did you review the post earlier that Lorddavid put where it showed in another forum about the sample rate needing to be the same in order to simultaneously play audio / record video ? ...

Have you had these same issues in the R on 10.0 ? For ours, 10 was the most stable and 10.1 introduced a few more issues... I haven't installed many 4.2 roms as I've amazing battery life w/ stock ICS deodexed w/ 14 toggles..

I'd like to build an up to date PACman Rom.
[Samsung Captivate Glide] yohan4ws:
Knock yourself out :)

I believe the entire codework from ICS to JB is different, different drivers kernels etc. When doing a diff, EVERYTHING would come up as modified.
[Samsung Captivate Glide] spyke555:
Guys,

Using the libaudio from Adam77Root's github fixed the audio on the camera, new build on the way...

Skype and bluetooth issues remain.

For skype it is NOT a bit rate issue. You can test this in the following way:

- Start a test call

- When you hear the tone start tapping your mic once per second

- You will then hear your recording, the pitch is off, but the beat is fine... So there is something distorting the audio here, and I suspect it is a codec issue...

As for bluetooth it does seem to work, only we get static. This sounds to me as an encoding / encryption issue. Data is being sent over but the headset just can't make sense of it. A cheap headset just blasts out the static, a good one recognizes the noise and cancels it out.

I will give Adam77Root's suggestion to try the official i9103 source a try and let you know how I make out. I've fixed a few other things in the device tree (namely boot image params and mount points) and I've got that up on my github if anyone it interested.

Oh and I can also confirm that the bug in editing pictures in the gallery is in the kernel somewhere. Compiling the stock Samsung kernel allows this to work fine. BT audio is broken in a different way there also, pitch is fine but it is broken up badly and there were also a bunch of other issues.

We'll get there guys, just be patient...
[Samsung Captivate Glide] lorddavid:
A quick question, any idea why the picture rotate in every picture that you take?
[Samsung Captivate Glide] Meeho:
I just wanted to send a big THANK YOU to all you guys for reviving the Glide support. Can't wait to have fully working JB on our phones. Great work! :good:
[Samsung Captivate Glide] spyke555:
Not yet no...
[Samsung Captivate Glide] yohan4ws:
Quoting from General Forum...

Is he the only one not guilty of never taking a logcat of these issues ?? heh
[Samsung Captivate Glide] Adam77Root:
Skype fix

Here comes the Skype fix! This also solves using microphone and speaker parallelly. The fix is actually using the stock libaudio from Galaxy Tab 10.1 and adding the necessary modifications to libmedia and libaudioflinger. Voice calls work fine.

Note: These libs have the Samsung audio bug! Sometimes volume settings are a bit weird, even though I have enabled the patch. Be aware of this.

Link: http://www.mediafire.com/?49u6ua55kbr1j6b
[Samsung Captivate Glide] pm2gonzales:
Thanks Adam, gonna try this out!
[Samsung Captivate Glide] soadzoor:
you are awesome! skype now works with videochat option! The only issue so far is that I cannot change the speaker to the earpiece to use instead. neither in viber. anyone has a solution for this?
[Samsung Captivate Glide] Adam77Root:
This is a known bug. Maybe because of the Tab not having an earpiece.
[Samsung Captivate Glide] lorddavid:
Wow Thanks :D I am going to use right now :D (I hope that works with Magicjack :D )
[Samsung Captivate Glide] soadzoor:
warning! regular cell voice calls are also working with loudspeaker only when fix is installed
[Samsung Captivate Glide] lorddavid:
yeah, I see that problem haha
[Samsung Captivate Glide] jzamoras:
thanks for the heads up
[Samsung Captivate Glide] spyke555:
Thanks Adam77Root!

Can you tell me which sources you used for this? Finding 3 different versions of the GT-10.1 (not counting the 10.1v) and Samsung has a ton of ICS sources for each. Or is this a github repo?

Thanks!
[Samsung Captivate Glide] Adam77Root:
[MENTION=3605868]tonyp[/MENTION]: Do you have any idea about fixing Bluetooth A2DP? Coz BT works fine with the new 4.2 method too, only A2DP is broken. AFAIK it was broken on CM10 too (I don't have any BT headsets to test.). Should I just try the proprietary libs?

[MENTION=661882]spyke555[/MENTION]: I just downloaded a stock rom of GT10.1 and extracted the necessary libraries from it.

Sent from my CM10.1-powered GT-I9103
[Samsung Captivate Glide] yohan4ws:
I can confirm that bluetooth was ONLY working in GB and ICS (4.0.1). We never had a fully working Bluetooth with HSP (AFAIK A2DP was working...) When using HSP I can hear people OK, but people can't hear me.
[Samsung Captivate Glide] tonyp:
Oh I see, then the situation is different on your device.

We got a fully working BT on 4.1 - it did work with 4.2 as well but when using A2DP the sound was "accellerating" (3 times as fast as it should be).

I tried loads of different bluedroid configs but didn't find a fix, so I decided to research about replacing bluedroid with bluez, where everything did (and now does) work.

We're using proprietary blobs, but the situation will be totally different for you I guess.

If you wanna compare, here's our device tree:

https://github.com/CyanogenMod/android_device_lge_star-common

https://github.com/CyanogenMod/android_device_lge_p990
[Samsung Captivate Glide] bubor:
My bad, I'm not a experts, I only try everything, and maybe I've found something, or just learn. This is my first android phone. I read all tegra 2 device forums.

I asked you PM, because I think there some change in bluez package's source code, what I downloaded from samsung.

Anyway I'm more exciting with porting bluez to cm10.1, I dont care waste time, while I'm pretty sure I couldnt fix it.

I'm sorry, if I made fake hope, or more work to anyone.
[Samsung Captivate Glide] tonyp:
You have nothing to apologize for. xda is about development and sharing.

For one development-related PM like yours I get a dozen noob questions. :D

So don't worry, what you're doing here is what xda is about unlike the "how to make my phone cool" kids which are flooding the forums :good:
[Samsung Captivate Glide] bobbinthreadbare:
The Skype patch fixed my voip calls. Well, external speaker thing.. but I'm happy to have it working at all. Thanks. :)
[Samsung Captivate Glide] taiber2000:
so with a new solution pops up anther problem :( bummer.

maybe try extracting the libs from different source that have tegra 2 or even 3 - as far as i know the audio libs should stay the same.
[Samsung Captivate Glide] amppcguru:
Since installing the Skype patch whenever i try to make a call the dialer crashes saying "unfortunately contacts has stopped" ok

I've tried it on cm10.1, Carbon Rom & Pacrom, all with same results.

Sent from my Rooted Samsung SGH-i927 Captivate Glide

Running [MENTION=559414]ndroid[/MENTION] JB 4.2.2 PACrom & TWRP 2.4.4.0 using xda-dev app.
[Samsung Captivate Glide] bobbinthreadbare:
I have a Nexus 7 which is Tegra 3, I could grab some files if someone gives me instructions.
[Samsung Captivate Glide] yohan4ws:
I'm assuming you've completed a full system wipe each time ?

Are you using Titanium backup at all ? Have you fresh DL Skype from Play Store ?

I had issues w/ dialer & contacts when I first installed CM10.1 M3 when I recovered my call log from Titanium, what I did was wiped the call log and data from settings/apps ... I may have had to delete the data under Titanium as well. When you do this, for troubleshooting purposes, disable sync from your gmail account so the contacts don't download.

Just some ideas for you to try, I haven't attempted the skype patch yet.
[Samsung Captivate Glide] yohan4ws:
soadzoor what do you mean by this ? I'd like to try the fix but I'm not clear on what other issues it introduces.
[Samsung Captivate Glide] bobbinthreadbare:
The audio fix was taken from a tablet which doesn't have a speaker where you typically put your ear (just about the at&t logo & next to the front camera) so the audio is being routed through the rear (loud) speaker instead.
[Samsung Captivate Glide] yohan4ws:
thx for the quick reply...

Does this happen for regular cellular voice calls or just for skype/voip calls ?
[Samsung Captivate Glide] lorddavid:
Its happen in both. Not only skype
[Samsung Captivate Glide] yohan4ws:
OP updated with workaround and bluez info.