Closed Bug 850770 Opened 7 years ago Closed 7 years ago

Make the OpenSLES cubeb backend compile with a C compiler

Categories

(Core :: Audio/Video, defect)

defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: padenot, Assigned: padenot)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
So, there is a bug in the ndk header SLES/OpenSLES_AndroidConfiguration.h [1] [2], that prevent us to enable OpenSL by default in cubeb. Not sure why it works at all on B2G.

Either we do some command line hackery on the compiler (like -D__cplusplus), which I find terrible, or we steal the header from Android, and we patch it for now. The attached patch implements the latter.

I've submitted a patch upstream, let's see if it gets merged [3].

[1]: https://groups.google.com/forum/?fromgroups=#!topic/android-ndk/gt7YCohAgSU
[2]: platforms/android-9/include/SLES/OpenSLES_AndroidConfiguration.h in the SDK
[3]: http://code.google.com/p/android/issues/detail?id=53163
Attachment #724507 - Flags: review?(kinetik)
(In reply to Paul Adenot (:padenot) from comment #0)
> Either we do some command line hackery on the compiler (like -D__cplusplus),
> which I find terrible

On top of being terrible, it wouldn't work, because extern "C" is not allowed in C.
Another option is to build cubeb as C++ if it supports it.
Yeah, that would work as well but I'd rather get the ndk fixed, though. Being forced to switch language in a library because someone screwed up is not cool.
Even better when actually including the file in the cubeb_opensl.c file.
Attachment #724516 - Flags: review?(kinetik)
Attachment #724507 - Attachment is obsolete: true
Attachment #724507 - Flags: review?(kinetik)
As I wrote in Bug 848627 comment #6 . There are two ways to solve the buffer starvation problem.

> There are 2 ways to solve this problem. Both ways are very risky and need
> more gralloc buffers.
> [1] Increment MIN_UNDEQUEUED_BUFFERS from 2 to some value. Ensure the max
> number of gralloc buffers between GonkNativeWindow and Compositor. Modify
> camera hal to accept MIN_UNDEQUEUED_BUFFERS more than 2.
> 
> [2] Copy preview frames for rendering and GonkNativeWindow run in async
> mode.  The copied frames are throwed out of GonkNativeWindow for rendering.
> Original frames stay within GonkNativeWindow.
> 
> [1] needs nodification to camera hal and MediaStreamGraph. And more
> GraphicBuffers
> Camera hal of unagi does not work in MIN_UNDEQUEUED_BUFFERS more than 2.
> 
> [2] needs a cpu time for copy video frames. And more GraphicBuffers. But it
> does not scale to high resolution preview.
(In reply to Sotaro Ikeda [:sotaro] from comment #4)
> As I wrote in Bug 848627 comment #6 . There are two ways to solve the buffer
> starvation problem.
> 
> > There are 2 ways to solve this problem. Both ways are very risky and need
> > more gralloc buffers.
> > [1] Increment MIN_UNDEQUEUED_BUFFERS from 2 to some value. Ensure the max
> > number of gralloc buffers between GonkNativeWindow and Compositor. Modify
> > camera hal to accept MIN_UNDEQUEUED_BUFFERS more than 2.
> > 
> > [2] Copy preview frames for rendering and GonkNativeWindow run in async
> > mode.  The copied frames are throwed out of GonkNativeWindow for rendering.
> > Original frames stay within GonkNativeWindow.
> > 
> > [1] needs nodification to camera hal and MediaStreamGraph. And more
> > GraphicBuffers
> > Camera hal of unagi does not work in MIN_UNDEQUEUED_BUFFERS more than 2.
> > 
> > [2] needs a cpu time for copy video frames. And more GraphicBuffers. But it
> > does not scale to high resolution preview.

sorry, it was for diffent bug.
Comment on attachment 724516 [details] [diff] [review]
Make the OpenSLES cubeb backend compile with a C compiler. r=

Now that we've got two headers, maybe we should move them to an "android" subdir in cubeb git.
Attachment #724516 - Flags: review?(kinetik) → review+
We still needed to include OpenSL_Android.h, so I readded that after sles_definitions.h:  https://github.com/kinetiknz/cubeb/commit/c9c97571980ca77c990a763802c11682a332cbd6

I've got an mq with this patch and the other pending cubeb patches ready to land, so I'll take care of them all as soon as the tree reopens.
Fix by bug 698328.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.