Reading an shmsink stream from an external application

Hamza Chouh hchouh at gmail.com
Fri Jul 6 07:33:37 PDT 2012


I finally understood the previous problem, but am now facing another one.
Using the following code (which corrects my first problem) :

int fd = sp_get_fd(pipe);
>
>     fd_set rfds;
>     FD_ZERO(&rfds);
>     FD_SET(fd, &rfds);
>     select(fd+1, &rfds, NULL, NULL, NULL);
>
>     int k = recv_to_buffer (pipe, buffer);
>     sp_client_recv_finish(pipe, buf);
>

I get the following error :

shmTest: shmpipe.c:729: sp_client_recv_finish: Assertion `shm_area' failed.
> Abandon
>

Looks like my pipe get no ShmArea, right ? Where could this error come from
?

Thanks.

2012/7/6 Hamza Chouh <hchouh at gmail.com>

> Thank you for your answers.
>
> The easiest route is to use the "shmsrc" element in your external
>> application, otherwise you will have to write your own shmsrc-like
>> client for your application.
>> If it's of any help, a while ago I made a minimal python example using
>> the shmsrc and shmsink elements that might be of some use:
>>
>> https://github.com/tmatth/gst-prototypes/tree/master/shm
>>
>> Best,
>> Tristan
>>
> I think I'll be forced to write my own shmsrc-like (actually, if I found a
> way to directly send my audio stream to the application without shm, I
> would). Anyway, I'll try to understand your python example which seems
> interesting.
>
>
> Copy shmpipe.[ch] and shmalloc.[ch] into your application and use the
>> read API described in shmpipe.h (sp_client_* sp_close, sp_get_fd) to get
>> the buffers.
>
>
> I already started to try use this API. So, if I understood well, I have to
> :
>
>    1. Open a client connection with the server : ShmPipe * pipe =
>    sp_client_open(PATH);
>    2. Wait for data to read : select(sp_get_fd(pipe), &rdfs, NULL, NULL,
>    NULL);
>    3. Then receive the data to read : sp_client_recv(pipe, my_buffer);
>    4. And finally finish to read using : sp_client_recv_finish()
>
> Now it seems very clear to me, however I still can't get it work : even if
> I send a stream to the specified path (using gst-launch audiotestsrc !
> shmsink socket-path=testpath), my little program waits eternally, not
> seeing any incoming data.
>
> I think I missed something really simple but I can't get it.
>
> 2012/7/5 Olivier Crête <olivier.crete at collabora.com>
>
>> Hi,
>>
>> On Thu, 2012-07-05 at 08:52 -0700, Takido wrote:
>> > Hello,
>> >
>> > I'm trying to feed an external application which deals sound to a
>> special
>> > hardware with shmsink. I read all the doc I could find about shm
>> (including
>> > the commented part of shmpipe.h) but I still don't understand they way I
>> > could get the audio stream in my external application.
>> >
>> > How can I do that ?
>>
>> Copy shmpipe.[ch] and shmalloc.[ch] into your application and use the
>> read API described in shmpipe.h (sp_client_* sp_close, sp_get_fd) to get
>> the buffers.
>>
>> --
>> Olivier Crête
>> olivier.crete at collabora.com
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20120706/3f31b66d/attachment.html>


More information about the gstreamer-devel mailing list