Problem when binding Android Surface to glimagesink

Wei Lee wm7101 at gmail.com
Fri May 6 08:28:57 UTC 2016


Hi Sebastian,

Thanks for your reply. The following is my GStreamer code.

http://paste.ofcode.org/3npqJKDwgavsxnGvL8ws5k


Basically, I follow the tutorial and does not modify a lot. And it could
work well if I use SurfaceView and get Surface just like the tutorial does.

However, since I want to play video using Google cardboard SDK, I use an
OpenGL ES engine on Android called Rajawali. It gives me a Surface which is
created by a SurfaceTexture. If I use the Surface like this:

SufaceTexture surfaceTexture; // Created by engine
Surface surface = new Surface(surfaceTexture);
nativeSurfaceInit(surface);

In this case, it will draw the content on a new Context which is not
rendered by the engine.
However, if I use Surface by Android MediaPlayer like this:

SufaceTexture surfaceTexture; // Created by engine
Surface surface = new Surface(surfaceTexture);
MediaPlayer mp = MediaPlayer.create(mContext, R.raw.test);
mp.setSurface(surface);
mp.start();

It will not create a new context and render on the current context so I can
see the result.
It seems glimagesink will create a new context to draw by default.
Is it possible to do some operations to make glimagesink draw content on
original context just like the MediaPlayer does?

Thanks a lot for your help.

Best regards,
Wei

2016-05-06 14:36 GMT+08:00 Sebastian Dröge-3 [via GStreamer-devel] <
ml-node+s966125n4677359h48 at n4.nabble.com>:

> On Do, 2016-05-05 at 05:52 -0700, Wei Lee wrote:
>
> > Hi everyone,
> >
> > I am new to GStreamer. I am developing an Android app which could play
> video
> > using GStreamer. I have a SurfaceTexture to link with video sink on the
> > GStreamer side. First, I get a Surface from SurfaceTexture and pass it
> to
> > the native GStreamer codes just like  this tutorial
> >
> > . The differences are that I use GStreamer 1.0 rather than 0.1 and I
> > modified my pipeline to
> >
> > "videotestsrc ! videoconvert ! glimagesink"
> >
> > for simple testing. However, I cannot see the correct result. All I see
> is
> > all blank.
> >
> > But if I link a Surface which is from a SurfaceView just like the
> tutorial,
> > I could see the result correctly.
> > Also, if I bind the Surface not with GStreamer codes but with Android
> > MediaPlayer object by setSurface() method of it, the result is fine too.
> >
> > After using an OpenGL ES Debugger on Android, I found out that when I
> link
> > Surface with glimagesink , it will somehow trigger eglCreateContext()
> and
> > put data in that Context rather than the original one. I guess that is
> the
> > reason why I get blank view. All the data is drawn on a context which is
> > unseen.
> >
> > Could anybody give me some hints to fix the problem ?
> Can you share your code? It's expected that glimagesink is using its
> own GL context for rendering into the surface and not any of the
> application contexts.
>
> You can find an example that works with 1.x here:
>
> https://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/tree/gst-sdk/tutorials/android-tutorial-3
>
> --
> Sebastian Dröge, Centricular Ltd · http://www.centricular.com
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email] <http:///user/SendEmail.jtp?type=node&node=4677359&i=0>
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> *signature.asc* (968 bytes) Download Attachment
> <http://gstreamer-devel.966125.n4.nabble.com/attachment/4677359/0/signature.asc>
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://gstreamer-devel.966125.n4.nabble.com/Problem-when-binding-Android-Surface-to-glimagesink-tp4677346p4677359.html
> To unsubscribe from Problem when binding Android Surface to glimagesink, click
> here
> <http://gstreamer-devel.966125.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4677346&code=d203MTAxQGdtYWlsLmNvbXw0Njc3MzQ2fDEzOTcwODU3MA==>
> .
> NAML
> <http://gstreamer-devel.966125.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Problem-when-binding-Android-Surface-to-glimagesink-tp4677346p4677363.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160506/7ca5b62c/attachment.html>


More information about the gstreamer-devel mailing list