-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[camera] Set encoding bitrate to recording bitrate (fixes 38787) #2426
Conversation
Full disclosure. I followed the CONTRIBUTING.md to the best of my ability. The So, I know the code "works". And I'm hoping the automated tests here (or a reviewer with a better setup) will confirm that all of the various tests pass. |
Yes! All 17 checks have passed! |
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 for the contribution! The fix here LG, but all PRs need to have automated tests before we can merge them into the tree. See Tree Hygiene #4.
Unfortunately adding tests for this is going to be tricky. I think the best bet would be adding a JUnit test in Android Studio or another Java IDE for Camera.java
, and then making sure that setAudioEncodingBitRate
is called. There's an existing JUnit test for If there's any possible way you could check for this in an e2e test there's also Flutter driver tests in
example/test_driver`, but from the description on the bug it sounds like this is a difficult thing to test for.
What do you think?
Is there an existing test file where I can I looked for the setter above it in the project and only found the one call in the file I edited. If I had found a similar test, I would have tried to use that convention to add a new test/assert/etc. If there is an existing file to add test code to, I'll attempt it. If there is not, and that requires me to create tests for this existing plugin from scratch, I will not have the bandwidth to do it. (We'll probably have to run the fork for now.) |
I don't think we have an existing test case similar to this, thanks for letting us know that you don't have the bandwidth. We'll shepherd the fix forward from here, thanks again for the contribution! |
@collinjackson would this benefit from some of the testing work you've been overseeing? |
@bparrishMines do you have time to do the review for this fix? |
I also run in to this problem and I´m glad to find the fix. Because this is a minor fix I would be happy to see it approved. |
Please we need this |
as long as this fix isn`t merged you can specifiy the fixed branch as target for camera package to avoid audio problems on android dependencies:
camera:
git:
url: https://github.com/DealerPeak/plugins.git
path: packages/camera
ref: camera-fix-android-audio for me it works, ....so 👍 for MR |
It it possible to merge also this into master. This will add support for flash light on Android
|
Is this fixed yet? It's ridiculous that it was even a problem to begin with! Did no one ever take a video? |
I fixed the conflicts. You're welcome to merge any time you want... In the meantime, I pinned my dependency to this branch on our fork. |
Really you guys. This is very frustrating. (cc @mklim @bparrishMines) If you don't want my PR, then, let me know. But, please, do the following (on an Android phone):
Audio on Android sounds bad. It takes one line of code to fix it. I get that you have rules. But, this is embarassing. Nobody that wants to do any video recording with audio on Android can do so with the official camera plugin. |
@@ -125,6 +125,7 @@ private void prepareMediaRecorder(String outputFilePath) throws IOException { | |||
// There's a specific order that mediaRecorder expects. Do not change the order | |||
// of these function calls. | |||
if (enableAudio) mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); | |||
if (enableAudio) mediaRecorder.setAudioEncodingBitRate(recordingProfile.audioBitRate); |
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.
This is it guys. @mklim @tvolkert @BesartLaci @kev2513 @bparrishMines
Do you not trust that this fixes it? Without this change, I couldn't have launched our app (which is in production with hundreds of users on both iOS and Android). Without this change the audio is garbled.
How do we get this merged?
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.
@cfchris some of our plugin PRs are in a state where we're transitioning ownership of them from the "core Flutter team" to community owners, and unfortunately, your PR got caught in that transition. I apologize. We'll try to make sure this gets unblocked in the next few days.
If you don't have resolution by next Friday (Oct 9), please ping me, and I'll make sure this is resolved.
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 so much @tvolkert !
I know there are a bunch of people that are going to be very happy to have this fixed and switch back to the main repo instead of our various forks.
@cfchris I took the liberty to write the necessary unit-tests to make sure the code is covered. Unfortunately I couldn't add find your fork in the "compare across forks" list when creating a PR and decided to just create a new PR (#3124) on the flutter/plugins repo. Of course I based my changes on your fork so your commits will also be included in the new PR. It would be great if you can have a look and if you agree with the changes leave a comment with the text |
@mvanbeusekom thank you so much for moving this forward. I looked at your code and it looks good. The one last thing I'm going to do is clone your fork and test the example app with your code changes. If that works, I'll add that consent. |
I'm withdrawing this PR. It is replaced by pull request #3124. |
Description
This fixes flutter/flutter#38787. The code I added is the code that was suggested by the issue author.
I had the same problem as the issue author (garbled, tinny sound in Android Video). I applied their fix and it fixed the issue. (Sound is now nice and clear.)
Related Issues
fixes flutter/flutter#38787
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?