-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android: Use common CBuffer instead of custom RingBuffer #1528
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Didn't check it logic wise, but please have a look at the styling.
android/sound.cpp
Outdated
static_cast<int16_t>(floatData[frmNum * oboeStream->getChannelCount() + channelNum] * _MAXSHORT); | ||
} | ||
} | ||
memcpy(vecsTmpInputAudioSndCrdStereo.data(),floatData,sizeof(int16_t)*numFrames * oboeStream->getChannelCount()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the style is not correct here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, is there a .clang-format I can use? I believe I saw something in the issues/discussions but I don't know if it finally materialized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's here: https://github.com/jamulussoftware/jamulus/pull/1127/files#diff-1026e0038b722990204a42bed8a6f7c0ec2302aa79e3fad1959d62ba968edfa2
It's still not merged and done for existing code yet, but new code can certainly be run through this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, new commit after applying .clang-format as indicated by @hoffie
Thanks
android/sound.cpp
Outdated
", SampleRate: " << sSampleRate << | ||
", AudioFormat: " << sAudioFormat << | ||
", FramesPerCallback: " << sFramesPerCallback << "]"; | ||
qInfo() << "Stream details: [sDirection: " << sDirection << ", FramesPerBurst: " << sFramesPerBurst << ", BufferSizeInFrames: " << sBufferSizeInFrames |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this is a good test for the .clang-format. The width is just a little too high - this exceeds Github's unified diff frame width.
android/sound.cpp
Outdated
|
||
return iOboeBufferSizeMono; | ||
} | ||
|
||
// This is the main callback method for when an audio stream is ready to publish data to an output stream | ||
// or has received data on an input stream. As per manual much be very careful not to do anything in this back that | ||
// can cause delays such as sleeping, file processing, allocate memory, etc. | ||
oboe::DataCallbackResult CSound::onAudioReady ( oboe::AudioStream* oboeStream, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I guess this is one of the things we may have to live with going with the .clang-format.
@sthenos - as you did the original Android work, is there a chance you could review this, please? Looks okay to me but I've no Android knowledge. |
OK, one more question raised in the code - but it's probably an example showing clearly someone who knows Android (i.e. not me!) needs to review this. |
Sorry, I'm currently away from my desk and I cannot check, but I thought it was the other way: Android code was using float while the rest of jamulus used pcm16.
The original (non working) code used float. When I introduced the small modifications that make it start working I commented about that and I was told that there was an upcoming change to move everything to float.
When I wrote this PR, I checked and the change to float hadn't happened, so I removed the extra code converting from float to int and configured oboe to use pcm16.
When this week I updated the PR I didn't check again if jamulus was still using pcm16 or was already using floats.
When I get back home I'll review that.
|
Thanks. It may have been as you say when the original Android branch was taken - it's not that long since Jamulus switched from int to float. ... and I could even be wrong! (I try to avoid the low-level audio stuff as much as I try to avoid the low-level network stuff: break those and you're not jamming :) ) |
Ok, thanks. I'll review and modify accordingly and resubmit once is ready
and retested.
Cheers
Julian
El sáb., 26 jun. 2021 13:06, Peter L Jones ***@***.***>
escribió:
… Thanks. It may have been as you say when the original Android branch was
taken - it's not that long since Jamulus switched from int to float.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1528 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUIC4RY4SRRMY25A2Y2GUTTUWYBTANCNFSM43DHFYKA>
.
|
Oh, well, I'm puzzled. I see that on void ProcessCallback ( CVector<int16_t>& psData ) That, I believe, still indicates that (at least the input) is still expected to be int16_t data, not float. I see that the Issue #544 was closed and the related PR #535 and #627 were merged on a separate branch (no longer active). In PR #660 it is mentioned that a previous attempt (#535) had to be reverted and this PR was closed with
So.... I'd say that the change to float never happened. |
Thanks for checking (and no wonder I was confused by the sound of it!). |
@j-santander @pljones What's missing here? |
Thanks for pinging me on this -- as it reminds me again that we're not yet float. At some point that work needs to be completed. But that's for a different time..! In terms of review: it needs someone who knows the Android audio subsystem and how to do Android development to comment on it. |
It would be really great if someone with android knowledge could move this forward. |
I'll have a look, when i get a chance.
Cheers
Simon
…On Sun, 2 Jan 2022, 17:59 ann0see, ***@***.***> wrote:
@sthenos <https://github.com/sthenos> - as you did the original Android
work, is there a chance you could review this, please?
It would be really great if someone with android knowledge could move this
forward.
—
Reply to this email directly, view it on GitHub
<#1528 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACVI4UJJ6CAQSDGFESULBNDUUCHAPANCNFSM43DHFYKA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
The float work that was done was specifically in the mixing ( Once the final sum of the samples was calculated, it then was converted back to Of course, the protocol audio data is Opus encoded, so the remaining question would be whether it is possible/better/worse to get the uncompressed audio in and out of Opus in |
I have squashed this into a single commit from the branch point, and included a necessary fix to I will get it rebased to the current Marking this PR as draft in the meantime. |
Android update replacing PR #1528
A couple of changes to the android code:
CBuffer
class inbuffer.h
). Later I realized there were some mistakes in my ring buffer... so now I've taken the opportunity to remove it and use the common CBuffer instead.I've verified the build on my terminal (Google Pixel 3a)