SurfaceTexture in GStreamer (Android) ?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

SurfaceTexture in GStreamer (Android) ?

sazzad1009
Hi,
Is there any way to use SurfaceTexture in GStreamer (Android) to render video directly in OpenGL textures?
SurfaceTexture is supported by Android MediaPlayer. However, MediaPlayer has higher latency for rendering live video (~2 Sec.). Therefore, I was hoping to use GStreamer instead of MediaPlayer in Android side to reduce this latency. However, not sure GStreamer can support SurfaceTexture type OpenGL rendering.

I will appreciate any input!

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: SurfaceTexture in GStreamer (Android) ?

Nicolas Dufresne-3
Le jeudi 05 juin 2014 à 09:30 -0700, sazzad1009 a écrit :

> Hi,
> Is there any way to use SurfaceTexture in GStreamer (Android) to render
> video directly in OpenGL textures?
> SurfaceTexture is supported by Android MediaPlayer. However, MediaPlayer has
> higher latency for rendering live video (~2 Sec.). Therefore, I was hoping
> to use GStreamer instead of MediaPlayer in Android side to reduce this
> latency. However, not sure GStreamer can support SurfaceTexture type OpenGL
> rendering.
>
> I will appreciate any input!
>
> Thanks!
>
The goal is to use this to do zero-copy on Android. This was initially
started by Andoni Morales and now being resumed by Matthieu Bouron. He
reports his progress at:

https://bugzilla.gnome.org/show_bug.cgi?id=731204

cheers,
Nicolas

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: SurfaceTexture in GStreamer (Android) ?

pedjaman
Hello everyone.

I was trying to use
https://github.com/sdroege/gst-player
as a base for my project.

If i try to set openGL surface, in following way:

                mSurface = new SurfaceTexture(mTextureID);
                mSurface.setOnFrameAvailableListener(this);

                Surface surface = new Surface(mSurface);
                mGstMediaPlayer.setSurface(surface); // This is Player code from example above

I hear sound, everything seems ok, but texture is black.
Also, frame available notification is received properly.
Method above works by simply replacing gstreamer with Android MediaPlayer or VLC or whatever else.

Any advice?

Thanks people :)
Reply | Threaded
Open this post in threaded view
|

Re: SurfaceTexture in GStreamer (Android) ?

Damien Dejean-2
Hello,

This is probably a layout issue. Android does not know the size of the
surface texture during the mesure pass (onMeasure() method of
SurfaceTexture class) because the underlying surface property is not
published.

You have two solutions, either you extends SurfaceTexture to return a
size in the onMeasure() method, or you layout this surface in a layout
like AnimatorView that will change its properties.

Note that all those information are only deduced from my own experiment.
I'm not very clear about what's going on in such situation.

BR,

Damien.


Le 09/12/2016 à 04:13 PM, pedjaman a écrit :

> Hello everyone.
>
> I was trying to use
> https://github.com/sdroege/gst-player
> <https://github.com/sdroege/gst-player>  
> as a base for my project.
>
> If i try to set openGL surface, in following way:
>
>                 mSurface = new SurfaceTexture(mTextureID);
>                 mSurface.setOnFrameAvailableListener(this);
>
>                 Surface surface = new Surface(mSurface);
>                 mGstMediaPlayer.setSurface(surface); // This is Player code
> from example above
>
> I hear sound, everything seems ok, but texture is black.
> Also, frame available notification is received properly.
> Method above works by simply replacing gstreamer with Android MediaPlayer or
> VLC or whatever else.
>
> Any advice?
>
> Thanks people :)
>
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/SurfaceTexture-in-GStreamer-Android-tp4667379p4679535.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: SurfaceTexture in GStreamer (Android) ?

pedjaman
Thank you for fast response.

Surfaces do not have onMeasure methods.
They also cannot be used in layout as they are not visible elements.

I assume you are referring to SurfaceView. But i need to render to a Surface. Size of this surface is known as it is constructed from openGL texture of known size. Other players recognize it properly.

Reply | Threaded
Open this post in threaded view
|

Re: SurfaceTexture in GStreamer (Android) ?

pedjaman
For these who are interested:

Problem was in SurfaceTexture reporting size as 1 x 1 (despite of being 1920, 1080)
Therefore, gstreamer was rendering to a single pixel.

by calling:

                mSurface.setDefaultBufferSize(1920, 1080);

everything was resolved.

Thansk everyone :)