I want to use libstagefright.so
in android phones for media operations. I have explored example given in this page. I have been trying to implement the same. While testing this implementation for multiple OMXCodec
instances, it's output buffer conflicts with each other.
I have developed an android project in eclipse and linked libstagefright
under JNI. I have added two classes CustomDataSource
(Which derives MediaSource
) and CustomOmxDecoder
. CustomDataSource
class implements all virtual methods of MediaSource
. In CustomOmxDecoder
class, I call OMXCodec::Create
method. Then I have created two threads which have individual instance of CustomOmxDecoder
. Using this instances I call a method ProcessNextFrame
in which I call the main, videoDecoder->read()
method. This is how my setup is.
Now, When I run the app with above mentioned setup. OMXCodec
decodes frames of both source but when I render it on surface, is shows me conflicted output. It seems like decoded buffer of both source get meshed up internally somehow. I am creating two h264 decoder simultaneously. What can be the problem here? Can it be related to MediaBufferGroup
? I acquirebuffer in CustomDataSource
and release buffer in CustomOmxDecoder
's ProcessNextFrame
after calling videoDecoder->read()
call.
Any suggestion will be great. Thanks.
I have tested and solved my issue, doubting that multiple instances of OMXCodec is possible. The issue was in my code. And on fixing up, I can see OMXCodec's mulitple instance running stable and smooth. So, Yes, Mulitple instances of OMXCodec is possbile.
Thank you all.