3gp demux plugin working on PC but not on target

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

3gp demux plugin working on PC but not on target

Rahul Verma
3gp demux plugin working on PC but not on target

Hi,

I am developing a 3gp Demux plugin.

My pipeline is filesrc ! 3gpreader(custom) ! mpeg4decoder(custom) ! xvimagesink. This works properly on the PC. But when I try to run the same pipeline on target

filesrc ! 3gpreader(custom) ! mpeg4decoder(custom) ! v4l2videosink, it does not work.

I get the following error :

gst_bus_new:<bus0> created new bus

Caught SIGSEGV accessing address (nil)

Spinning.  Please run 'gdb gst-launch 129' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.

After checking the source files it is while attaching the bus to the pipeline.

However pipeline
filesrc ! ffdemux_mov_mp4_m4a_3gp_3g2_mj2 ! mpeg4decoder(custom) ! v4l2videosink works fine with GST_DEBUG=0.

In this pipeline also if I set GST_DEBUG=3/4/5 i get the same SIGSEGV fault at the same point.

I am stuck here and need some pointers.

Regards,
Rahul

SASKEN BUSINESS DISCLAIMER
-------------------------
This message may contain confidential, proprietary or legally privileged information. In 
case you are not the original intended Recipient of the message, you must not, directly or 
indirectly, use, Disclose, distribute, print, or copy any part of this message and you are 
requested to delete it and inform the sender. Any views expressed in this message are 
those of the individual sender unless otherwise stated. Nothing contained in this message 
shall be construed as an offer or acceptance of any offer by Sasken Communication 
Technologies Limited ("Sasken") unless sent with that express intent and with due 
authority of Sasken. Sasken has taken enough precautions to prevent the spread of 
viruses. However the company accepts no liability for any damage caused by any virus 
transmitted by this email

------------------------------------------------------------------------------

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

Re: 3gp demux plugin working on PC but not on target

Stefan Sauer
Rahul Verma schrieb:

>
> Hi,
>
> I am developing a 3gp Demux plugin.
>
> My pipeline is filesrc ! 3gpreader(custom) ! mpeg4decoder(custom) !
> xvimagesink. This works properly on the PC. But when I try to run the
> same pipeline on target
>
> filesrc ! 3gpreader(custom) ! mpeg4decoder(custom) ! v4l2videosink, it
> does not work.
>
> I get the following error :
>
> gst_bus_new:<bus0> created new bus
>
> Caught SIGSEGV accessing address (nil)
>
> Spinning.  Please run 'gdb gst-launch 129' to continue debugging, Ctrl-C
> to quit, or Ctrl-\ to dump core.
>
> After checking the source files it is while attaching the bus to the
> pipeline.
>
> However pipeline
> filesrc ! ffdemux_mov_mp4_m4a_3gp_3g2_mj2 ! mpeg4decoder(custom) !
> v4l2videosink works fine with GST_DEBUG=0.
>
> In this pipeline also if I set GST_DEBUG=3/4/5 i get the same SIGSEGV
> fault at the same point.
>
> I am stuck here and need some pointers.
>
> Regards,
> Rahul

We can't help you with such problems, as we don't have the sources for your
elements. If you don't have a gdb or your tagets, you need to try to get some
sort of logging working to track the problem down.

Stefan

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

Re: 3gp demux plugin working on PC but not on target

michael smith-6-3
In reply to this post by Rahul Verma
On Tue, Jan 6, 2009 at 2:40 AM, Rahul Verma <[hidden email]> wrote:

>
> Hi,
>
> I am developing a 3gp Demux plugin.
>
> My pipeline is filesrc ! 3gpreader(custom) ! mpeg4decoder(custom) !
> xvimagesink. This works properly on the PC. But when I try to run the same
> pipeline on target
>
> filesrc ! 3gpreader(custom) ! mpeg4decoder(custom) ! v4l2videosink, it does
> not work.
>
> I get the following error :
>
> gst_bus_new:<bus0> [00m created new bus
>
> Caught SIGSEGV accessing address (nil)

Without the source to your plugin, all we can say about this
particular crash is "it's presumably a bug in your plugin, you'll need
to fix it".

That said, why aren't you using qtdemux? GStreamer includes a fairly
full-featured, high quality demuxer for
quicktime-and-qt-derived-formats like 3gp, and it works well already.

Mike

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 3gp demux plugin working on PC but not on target

Rahul Verma
In reply to this post by Rahul Verma
Re: 3gp demux plugin working on PC but not on target

Hi,


> That said, why aren't you using qtdemux? GStreamer includes a fairly
> full-featured, high quality demuxer for
> quicktime-and-qt-derived-formats like 3gp, and it works well already.

We use the qtdemux extensively and find it very stable. We are developing out 3gp plugin as an experiment just to learn more about the GStreamer framework.

> Without the source to your plugin, all we can say about this
> particular crash is "it's presumably a bug in your plugin, you'll need
> to fix it".

I will try to explain about my problem in more detail.

here is the initial code snippet

GST_BOILERPLATE(Gst3gpReader, gst_3gpreader, GstElement, GST_TYPE_ELEMENT);

static gboolean plugin_init(GstPlugin *plugin)
{
        GST_DEBUG_CATEGORY_INIT(gst_3gpreader_debug, "SASKEN3GPREADER", 0, "Sasken 3gp reader");
        return gst_element_register(plugin, "sasken3gpreader", GST_RANK_NONE, GST_TYPE_3GPREADER);
}

static GstElementDetails element_details =
{
                        "sasken 3gp reader",
                        "3gpreader",
                        "sasken 3gp reader reader for GStreamer",
                        "Rahul Verma<[hidden email]>"
};

GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, "Sasken3gpReader",
                "Sasken 3gp reader plugin for GStreamer",
                plugin_init,
                VERSION,
                "Proprietary",
                "Sasken",
                "http://www.sasken.com")

static void gst_3gpreader_base_init(gpointer klass)
{
       //here I Just add the static pad templates to the element and the element details
}

static void gst_3gpreader_class_init(Gst3gpReaderClass *klass)
{
      //here I just assign the change_state function pointer
}

static void gst_3gpreader_init(Gst3gpReader *filter, Gst3gpReaderClass *klass)
{
      //here I set the activate, activate_push and activate_pull function pointer
      //add the sink pad
}

Then in the other functions I do the internal parsing and passing the buffer to the downstream plugins to be decoded and displayed.

All this work fine in the host(PC). But on target it fails and i don't know how to proceed further. I am also attaching a part of the logs(related to 3gp reader because the entire logs was of 1.7 MB)

Also the pipeline
filesrc location=c.3gp ! ffdemux_mov_mp4_m4a_3gp_3g2_mj2 ! ffdec_mpeg4 ! v4l2videosink, with GST_DEBUG=3, gives the same problem, but works fine with GST_DEBUG=0.

My pipeline doesn't work for any GST_DEBUG level.

Any pointers will be helpful.


Regards,
Rahul

>
> Hi,
>
> I am developing a 3gp Demux plugin.
>
> My pipeline is filesrc ! 3gpreader(custom) ! mpeg4decoder(custom) !
> xvimagesink. This works properly on the PC. But when I try to run the same
> pipeline on target
>
> filesrc ! 3gpreader(custom) ! mpeg4decoder(custom) ! v4l2videosink, it does
> not work.
>
> I get the following error :
>
> gst_bus_new:<bus0> [00m created new bus
>
> Caught SIGSEGV accessing address (nil)

Without the source to your plugin, all we can say about this
particular crash is "it's presumably a bug in your plugin, you'll need
to fix it".

That said, why aren't you using qtdemux? GStreamer includes a fairly
full-featured, high quality demuxer for
quicktime-and-qt-derived-formats like 3gp, and it works well already.

Mike

SASKEN BUSINESS DISCLAIMER
-------------------------
This message may contain confidential, proprietary or legally privileged information. In 
case you are not the original intended Recipient of the message, you must not, directly or 
indirectly, use, Disclose, distribute, print, or copy any part of this message and you are 
requested to delete it and inform the sender. Any views expressed in this message are 
those of the individual sender unless otherwise stated. Nothing contained in this message 
shall be construed as an offer or acceptance of any offer by Sasken Communication 
Technologies Limited ("Sasken") unless sent with that express intent and with due 
authority of Sasken. Sasken has taken enough precautions to prevent the spread of 
viruses. However the company accepts no liability for any damage caused by any virus 
transmitted by this email

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

logs_target1.txt (9K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: 3gp demux plugin working on PC but not on target

michael smith-6-3
On Wed, Jan 7, 2009 at 4:02 AM, Rahul Verma <[hidden email]> wrote:

> Hi,
>
>
>> That said, why aren't you using qtdemux? GStreamer includes a fairly
>> full-featured, high quality demuxer for
>> quicktime-and-qt-derived-formats like 3gp, and it works well already.
>
> We use the qtdemux extensively and find it very stable. We are developing
> out 3gp plugin as an experiment just to learn more about the GStreamer
> framework.

Fair enough.

>
>> Without the source to your plugin, all we can say about this
>> particular crash is "it's presumably a bug in your plugin, you'll need
>> to fix it".

Really, this doesn't help too much. You'll need to attach a debugger
and see where things are going wrong. It could be that one of the
libraries gstreamer uses was compiled wrongly, so things are going
wrong "randomly", or it could be a bug in your plugin - we can't
guess. You might also find running it on a PC using a tool like
valgrind helpful - it might show you something you're doing wrong that
just luckily doesn't cause a crash on the PC, but does on your target
system.


Mike

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 3gp demux plugin working on PC but not on target

Rahul Verma
In reply to this post by Rahul Verma
Re: 3gp demux plugin working on PC but not on target

Hi,

>Really, this doesn't help too much. You'll need to attach a debugger
>and see where things are going wrong. It could be that one of the
>libraries gstreamer uses was compiled wrongly, so things are going
>wrong "randomly", or it could be a bug in your plugin - we can't
>guess. You might also find running it on a PC using a tool like
>valgrind helpful - it might show you something you're doing wrong that
>just luckily doesn't cause a crash on the PC, but does on your target
>system.

Finally I was able to get Audio and Video working on target using my 3gp
demux. As you pointed out correctly, bug was in my code. I was trying to
access the file location from filesrc element using the following code, and
it caused the crash.

        fileSrcPeerPad = gst_pad_get_peer(filter->sinkPad);
        if(NULL == fileSrcPeerPad)
        {
                GST_DEBUG("gone.. no src peer pad. ");
        }
        //extract the file src element here and get the filename, fd and uri
        fileSrcPeerElement = gst_pad_get_parent_element(fileSrcPeerPad);
       
        element_class = GST_ELEMENT_CLASS(fileSrcPeerElement);
       
        object_class = G_OBJECT_CLASS(element_class);
               
        //try to extract the location from this GObject.
        g_object_get(object_class, "location", &fileLocation, NULL);

and after that do the file operations. Surprisingly, this piece of code worked
on PC.

Can you help me in finding the error in the code??

Also, now I have some AV Sync issues. Till now I have not implemented any AV Sync
logic in my Demux or Sink. I am passing the video buffers decoded to the sink, but it
seems that video frames are dropped by the framework and after that I see continuous
breaks. Does the pipeline implement the frame drop logic? If yes what logic does it follow
for frame drops? can you guide me to the piece of code in the framework for a better
understanding.

Regards,
Rahul

       
>> Hi,
>>
>>
>>> That said, why aren't you using qtdemux? GStreamer includes a fairly
>>> full-featured, high quality demuxer for
>>> quicktime-and-qt-derived-formats like 3gp, and it works well already.
>>
>> We use the qtdemux extensively and find it very stable. We are developing
>> out 3gp plugin as an experiment just to learn more about the GStreamer
>> framework.

>Fair enough.

>>
>>> Without the source to your plugin, all we can say about this
>>> particular crash is "it's presumably a bug in your plugin, you'll need
>>> to fix it".

>Really, this doesn't help too much. You'll need to attach a debugger
>and see where things are going wrong. It could be that one of the
>libraries gstreamer uses was compiled wrongly, so things are going
>wrong "randomly", or it could be a bug in your plugin - we can't
>guess. You might also find running it on a PC using a tool like
>valgrind helpful - it might show you something you're doing wrong that
>just luckily doesn't cause a crash on the PC, but does on your target
>system.

SASKEN BUSINESS DISCLAIMER
-------------------------
This message may contain confidential, proprietary or legally privileged information. In 
case you are not the original intended Recipient of the message, you must not, directly or 
indirectly, use, Disclose, distribute, print, or copy any part of this message and you are 
requested to delete it and inform the sender. Any views expressed in this message are 
those of the individual sender unless otherwise stated. Nothing contained in this message 
shall be construed as an offer or acceptance of any offer by Sasken Communication 
Technologies Limited ("Sasken") unless sent with that express intent and with due 
authority of Sasken. Sasken has taken enough precautions to prevent the spread of 
viruses. However the company accepts no liability for any damage caused by any virus 
transmitted by this email

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 3gp demux plugin working on PC but not on target

michael smith-6-3
On Tue, Jan 13, 2009 at 3:43 AM, Rahul Verma <[hidden email]> wrote:

> Hi,
>
>>Really, this doesn't help too much. You'll need to attach a debugger
>>and see where things are going wrong. It could be that one of the
>>libraries gstreamer uses was compiled wrongly, so things are going
>>wrong "randomly", or it could be a bug in your plugin - we can't
>>guess. You might also find running it on a PC using a tool like
>>valgrind helpful - it might show you something you're doing wrong that
>>just luckily doesn't cause a crash on the PC, but does on your target
>>system.
>
> Finally I was able to get Audio and Video working on target using my 3gp
> demux. As you pointed out correctly, bug was in my code. I was trying to
> access the file location from filesrc element using the following code, and
> it caused the crash.
>
>         fileSrcPeerPad = gst_pad_get_peer(filter->sinkPad);
>         if(NULL == fileSrcPeerPad)
>         {
>                 GST_DEBUG("gone.. no src peer pad. ");
>         }
>         //extract the file src element here and get the filename, fd and uri
>         fileSrcPeerElement = gst_pad_get_parent_element(fileSrcPeerPad);
>
>         element_class = GST_ELEMENT_CLASS(fileSrcPeerElement);
>
>         object_class = G_OBJECT_CLASS(element_class);
>
>         //try to extract the location from this GObject.
>         g_object_get(object_class, "location", &fileLocation, NULL);
>
> and after that do the file operations. Surprisingly, this piece of code
> worked
> on PC.
>
> Can you help me in finding the error in the code??

The whole concept is badly broken. Your element should not be poking
at the implementation details of its peer - there's no reason to
expect that the peer even HAS a "location" property.

So, you should stop doing that entirely. I didn't check the actual
code to see if there was an obvious bug in the actual implementation,
because it really doesn't matter.


>
> Also, now I have some AV Sync issues. Till now I have not implemented any AV
> Sync
> logic in my Demux or Sink. I am passing the video buffers decoded to the
> sink, but it
> seems that video frames are dropped by the framework and after that I see
> continuous
> breaks. Does the pipeline implement the frame drop logic? If yes what logic
> does it follow
> for frame drops? can you guide me to the piece of code in the framework for
> a better
> understanding.

Your demuxer should not implement any sync logic - it should timestamp
the buffers it outputs, but nothing more than that.

The sink is responsible for all synchronisation - but in general, you
shouldn't need to implement anything special. The base classes
(GstBaseSink, or subclasses like GstBaseVideoSink) should implement
everything for you - you just need to specify that it's a synchronised
sink.

Frame dropping is also generally done by the sink base classes, if the
buffers arrive too late. Frame dropping SHOULD also be implemented in
decoders (particularly video decoders) in response to QoS messages
from the sinks. The documentation goes into more detail about how this
works (can't remember precisely where, probably the design docs).

Mike

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 3gp demux plugin working on PC but not on target

Rahul Verma
In reply to this post by Rahul Verma
Re: 3gp demux plugin working on PC but not on target

Hi,

Sorry for the late response, but was busy with other experiments with gstreamer.
Have a few more points to discuss. 

>>
>> Finally I was able to get Audio and Video working on target using my 3gp
>> demux. As you pointed out correctly, bug was in my code. I was trying to
>> access the file location from filesrc element using the following code, and
>> it caused the crash.
>>
>>         fileSrcPeerPad = gst_pad_get_peer(filter->sinkPad);
>>         if(NULL == fileSrcPeerPad)
>>         {
>>                 GST_DEBUG("gone.. no src peer pad. ");
>>         }
>>         //extract the file src element here and get the filename, fd and uri
>>         fileSrcPeerElement = gst_pad_get_parent_element(fileSrcPeerPad);
>>
>>         element_class = GST_ELEMENT_CLASS(fileSrcPeerElement);
>>
>>         object_class = G_OBJECT_CLASS(element_class);
>>
>>         //try to extract the location from this GObject.
>>         g_object_get(object_class, "location", &fileLocation, NULL);
>>
>> and after that do the file operations. Surprisingly, this piece of code
>> worked
>> on PC.
>>
>> Can you help me in finding the error in the code??

>The whole concept is badly broken. Your element should not be poking
>at the implementation details of its peer - there's no reason to
>expect that the peer even HAS a "location" property.
>
>So, you should stop doing that entirely. I didn't check the actual
>code to see if there was an obvious bug in the actual implementation,
>because it really doesn't matter.

Thanks Mike. Your point is valid. But for a 3gp reader, which works in a
pull mode, the file operations has to be done by the reader, since it
knows the parsing logic. If my understanding is correct, then it has to get
the file handle. What is the alternative way to get the file handle then?

>>
>> Also, now I have some AV Sync issues. Till now I have not implemented any AV
>> Sync
>> logic in my Demux or Sink. I am passing the video buffers decoded to the
>> sink, but it
>> seems that video frames are dropped by the framework and after that I see
>> continuous
>> breaks. Does the pipeline implement the frame drop logic? If yes what logic
>> does it follow
>> for frame drops? can you guide me to the piece of code in the framework for
>> a better
>> understanding.

>Your demuxer should not implement any sync logic - it should timestamp
>the buffers it outputs, but nothing more than that.

>The sink is responsible for all synchronisation - but in general, you
>shouldn't need to implement anything special. The base classes
>(GstBaseSink, or subclasses like GstBaseVideoSink) should implement
>everything for you - you just need to specify that it's a synchronised
>sink.

>Frame dropping is also generally done by the sink base classes, if the
>buffers arrive too late. Frame dropping SHOULD also be implemented in
>decoders (particularly video decoders) in response to QoS messages
>from the sinks. The documentation goes into more detail about how this
>works (can't remember precisely where, probably the design docs).

Thanks again Mike. I went through the implementation of the frame drop logic
in gstbasesink.c It is as you said, depending on Timestamp, duration and jitter.
I am still facing some AV Sync issues inspite of giving correct timestamp to the
video frames. Upon profiling i saw that the Jitter value keeps on increasing, forcing
the frames to be dropped. I also profiled the loop function of my demux and was surprised
to see that gst_pad_push was taking time in range or 150 ms, specially for audio. Since
pad_push is taking time, it increases the jitter and causes the frame drop.

my pipeline is

          filesrc ! 3gpdemux name=demux demux.! queue ! videodecoder ! videosink demux.! queue ! audiodecoder ! osssink

Is gst_pad_push a synchronous call and will be blocking? Initially all is well, but as soon as
rendering starts, gst_push_pad time starts increasing.

rahul

SASKEN BUSINESS DISCLAIMER
-------------------------
This message may contain confidential, proprietary or legally privileged information. In 
case you are not the original intended Recipient of the message, you must not, directly or 
indirectly, use, Disclose, distribute, print, or copy any part of this message and you are 
requested to delete it and inform the sender. Any views expressed in this message are 
those of the individual sender unless otherwise stated. Nothing contained in this message 
shall be construed as an offer or acceptance of any offer by Sasken Communication 
Technologies Limited ("Sasken") unless sent with that express intent and with due 
authority of Sasken. Sasken has taken enough precautions to prevent the spread of 
viruses. However the company accepts no liability for any damage caused by any virus 
transmitted by this email

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 3gp demux plugin working on PC but not on target

michael smith-6-3
On Mon, Jan 19, 2009 at 5:59 AM, Rahul Verma <[hidden email]> wrote:

>
>>The whole concept is badly broken. Your element should not be poking
>>at the implementation details of its peer - there's no reason to
>>expect that the peer even HAS a "location" property.
>>
>>So, you should stop doing that entirely. I didn't check the actual
>>code to see if there was an obvious bug in the actual implementation,
>>because it really doesn't matter.
>
> Thanks Mike. Your point is valid. But for a 3gp reader, which works in a
> pull mode, the file operations has to be done by the reader, since it
> knows the parsing logic. If my understanding is correct, then it has to get
> the file handle. What is the alternative way to get the file handle then?

If you're in pull mode, you can (and should) pull from the upstream
element - which might, internally, use some sort of 'file handle', but
equally, it might not.

To do this, you use gst_pad_pull_range() on your element's sinkpad.
You MUST NOT directly use any sort of file handle.
>
> my pipeline is
>
>           filesrc ! 3gpdemux name=demux demux.! queue ! videodecoder !
> videosink demux.! queue ! audiodecoder ! osssink
>
> Is gst_pad_push a synchronous call and will be blocking? Initially all is
> well, but as soon as
> rendering starts, gst_push_pad time starts increasing.


gst_pad_push() will not generally return immediately. In this
pipeline, your demuxer is pushing buffers into a queue element. That
should be very fast usually (it just takes the appropriate locks, then
adds the buffer to the queue element's internal queue of buffers.
However, if the queue is full, it'll block until the queue stops being
full.

In your case, I don't know why you're seeing increasing time taken for
pushing on your pad - perhaps your timestamps or wrong, or your sink
or decoder isn't working correctly?


Mike

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 3gp demux plugin working on PC but not on target

Rahul Verma
In reply to this post by Rahul Verma
Hi,


>If you're in pull mode, you can (and should) pull from the upstream
>element - which might, internally, use some sort of 'file handle', but
>equally, it might not.

Yes my plugin works in pull mode. But even in the reference
plugin(ffmpeg_demux), I saw functions av_input_file_open, av_read_frame
being used. I tried to go inside these functions and saw url_open and
similar functions being used. Is it not as good as getting a file
pointer directly and doing the file operations? What exactly do you mean
when you say it must pull data?

>gst_pad_push() will not generally return immediately. In this
>pipeline, your demuxer is pushing buffers into a queue element. That
>should be very fast usually (it just takes the appropriate locks, then
>adds the buffer to the queue element's internal queue of buffers.
>However, if the queue is full, it'll block until the queue stops being
>full.

>In your case, I don't know why you're seeing increasing time taken for
>pushing on your pad - perhaps your timestamps or wrong, or your sink
>or decoder isn't working correctly?

I checked the timestamp values again and I compared with the timestamp
values of the open source demuxer too. Since my 3gp reader gives time in
milliseconds I multiply it with 1000000 to convert it into nanoseconds
and give it to the sink. So the difference is very minor. Problem is
still the same. _loop function of my parser plugin is taking too much
time.

Currently in my loop function I am doing the following steps:

Seek to video offset.
Allocate video buffer from video source pad
Read from file into the buffer.
Push the buffer.

Same for audio.

I don't understand why _push_pad function time goes to 100s of
millisecond.

Regards,
Rahul





Message: 3
Date: Mon, 19 Jan 2009 10:24:26 -0800
From: Michael Smith <[hidden email]>
Subject: Re: [gst-devel] 3gp demux plugin working on PC but not on
        target
To: Discussion of the development of GStreamer
        <[hidden email]>
Message-ID:
        <[hidden email]>
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Jan 19, 2009 at 5:59 AM, Rahul Verma <[hidden email]>
wrote:

>
>>The whole concept is badly broken. Your element should not be poking
>>at the implementation details of its peer - there's no reason to
>>expect that the peer even HAS a "location" property.
>>
>>So, you should stop doing that entirely. I didn't check the actual
>>code to see if there was an obvious bug in the actual implementation,
>>because it really doesn't matter.
>
> Thanks Mike. Your point is valid. But for a 3gp reader, which works in
a
> pull mode, the file operations has to be done by the reader, since it
> knows the parsing logic. If my understanding is correct, then it has
to get
> the file handle. What is the alternative way to get the file handle
then?

If you're in pull mode, you can (and should) pull from the upstream
element - which might, internally, use some sort of 'file handle', but
equally, it might not.

To do this, you use gst_pad_pull_range() on your element's sinkpad.
You MUST NOT directly use any sort of file handle.
>
> my pipeline is
>
>           filesrc ! 3gpdemux name=demux demux.! queue ! videodecoder !
> videosink demux.! queue ! audiodecoder ! osssink
>
> Is gst_pad_push a synchronous call and will be blocking? Initially all
is
> well, but as soon as
> rendering starts, gst_push_pad time starts increasing.


gst_pad_push() will not generally return immediately. In this
pipeline, your demuxer is pushing buffers into a queue element. That
should be very fast usually (it just takes the appropriate locks, then
adds the buffer to the queue element's internal queue of buffers.
However, if the queue is full, it'll block until the queue stops being
full.

In your case, I don't know why you're seeing increasing time taken for
pushing on your pad - perhaps your timestamps or wrong, or your sink
or decoder isn't working correctly?


Mike

SASKEN BUSINESS DISCLAIMER
-------------------------
This message may contain confidential, proprietary or legally privileged information. In
case you are not the original intended Recipient of the message, you must not, directly or
indirectly, use, Disclose, distribute, print, or copy any part of this message and you are
requested to delete it and inform the sender. Any views expressed in this message are
those of the individual sender unless otherwise stated. Nothing contained in this message
shall be construed as an offer or acceptance of any offer by Sasken Communication
Technologies Limited ("Sasken") unless sent with that express intent and with due
authority of Sasken. Sasken has taken enough precautions to prevent the spread of
viruses. However the company accepts no liability for any damage caused by any virus
transmitted by this email


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 3gp demux plugin working on PC but not on target

michael smith-6-3
On Tue, Jan 20, 2009 at 5:43 AM, Rahul Verma <[hidden email]> wrote:

> Hi,
>
>
>>If you're in pull mode, you can (and should) pull from the upstream
>>element - which might, internally, use some sort of 'file handle', but
>>equally, it might not.
>
> Yes my plugin works in pull mode. But even in the reference
> plugin(ffmpeg_demux), I saw functions av_input_file_open, av_read_frame
> being used. I tried to go inside these functions and saw url_open and
> similar functions being used. Is it not as good as getting a file
> pointer directly and doing the file operations? What exactly do you mean
> when you say it must pull data?

ffmpeg_demux should not be used as a reference plugin for anything.
It's not a good example to use at all. Don't use it for any
comparisons; the ffmpeg demuxers are known to work poorly (and in many
cases not work at all).

 I don't actually know what it does internally - I haven't looked -
but a gstreamer demuxer plugin can't act on a file directly, because
it doesn't even know if there IS a file involved at all.

By "it must pull data" I mean that to get data from the upstream
element (in pull mode), you must use gst_pad_pull_range().



>
>>gst_pad_push() will not generally return immediately. In this
>>pipeline, your demuxer is pushing buffers into a queue element. That
>>should be very fast usually (it just takes the appropriate locks, then
>>adds the buffer to the queue element's internal queue of buffers.
>>However, if the queue is full, it'll block until the queue stops being
>>full.
>
>>In your case, I don't know why you're seeing increasing time taken for
>>pushing on your pad - perhaps your timestamps or wrong, or your sink
>>or decoder isn't working correctly?
>
> I checked the timestamp values again and I compared with the timestamp
> values of the open source demuxer too. Since my 3gp reader gives time in
> milliseconds I multiply it with 1000000 to convert it into nanoseconds
> and give it to the sink. So the difference is very minor. Problem is
> still the same. _loop function of my parser plugin is taking too much
> time.
>
> Currently in my loop function I am doing the following steps:
>
> Seek to video offset.
> Allocate video buffer from video source pad
> Read from file into the buffer.
> Push the buffer.
>
> Same for audio.
>
> I don't understand why _push_pad function time goes to 100s of
> millisecond.

I don't know either. Sorry, I can only give general suggestions, since
you're not writing an open source plugin. Looking at the debug output
(GST_DEBUG) might help you.

Mike

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 3gp demux plugin working on PC but not on target

Rahul Verma
In reply to this post by Rahul Verma
Hi,

>ffmpeg_demux should not be used as a reference plugin for anything.
>It's not a good example to use at all. Don't use it for any
>comparisons; the ffmpeg demuxers are known to work poorly (and in many
>cases not work at all).

>I don't actually know what it does internally - I haven't looked -
>but a gstreamer demuxer plugin can't act on a file directly, because
>it doesn't even know if there IS a file involved at all.

>By "it must pull data" I mean that to get data from the upstream
>element (in pull mode), you must use gst_pad_pull_range().

Thanks Mike, this helped a lot. I was referring to ffmpeg_demux all this while and was going on the wrong track. As you said, I used gst_pad_pull_range() and it works wonderfully well. Now I don't have any dependency on the file source file handle.

One additional thing I needed to clarify. I tried using the same buffer returned by gst_pad_pull_range() in the function gst_pad_push() and got a crash. I tried functions like gst_buffer_make_writeable(), but even that did not help much. For the time being I am doing a memcpy and pushing the data, which I think is not a clean way. It is also causing audio breaks. Is there a way I can bypass this memcpy??

>I don't know either. Sorry, I can only give general suggestions, since
>you're not writing an open source plugin. Looking at the debug output
>(GST_DEBUG) might help you.

This AV sync is the last major issue I am facing. For a few streams, AV sync works fine, but for one particular stream I am having a pretty hard time. Anyways, I will keep my experiments going and try to keep you informed too. GST_DEBUG is also of not much help because GST_DEBUG:3 and above causes crash at random places when I run the code on target.

Regards,
Rahul Verma
SASKEN BUSINESS DISCLAIMER
-------------------------
This message may contain confidential, proprietary or legally privileged information. In
case you are not the original intended Recipient of the message, you must not, directly or
indirectly, use, Disclose, distribute, print, or copy any part of this message and you are
requested to delete it and inform the sender. Any views expressed in this message are
those of the individual sender unless otherwise stated. Nothing contained in this message
shall be construed as an offer or acceptance of any offer by Sasken Communication
Technologies Limited ("Sasken") unless sent with that express intent and with due
authority of Sasken. Sasken has taken enough precautions to prevent the spread of
viruses. However the company accepts no liability for any damage caused by any virus
transmitted by this email


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 3gp demux plugin working on PC but not on target

michael smith-6-3
On Fri, Jan 23, 2009 at 3:46 AM, Rahul Verma <[hidden email]> wrote:
>
> Thanks Mike, this helped a lot. I was referring to ffmpeg_demux all this while and was going on the wrong track. As you said, I used gst_pad_pull_range() and it works wonderfully well. Now I don't have any dependency on the file source file handle.
>
> One additional thing I needed to clarify. I tried using the same buffer returned by gst_pad_pull_range() in the function gst_pad_push() and got a crash. I tried functions like gst_buffer_make_writeable(), but even that did not help much. For the time being I am doing a memcpy and pushing the data, which I think is not a clean way. It is also causing audio breaks. Is there a way I can bypass this memcpy??

You should be able to push a buffer that you have pulled from
upstream. If you can't, then presumably you're getting your
refcounting wrong somewhere (or there's some other problem; hard to
say...). When you just say "got a crash" it's not too helpful - you
need to at least find out where it's crashing, and why.


>
>>I don't know either. Sorry, I can only give general suggestions, since
>>you're not writing an open source plugin. Looking at the debug output
>>(GST_DEBUG) might help you.
>
> This AV sync is the last major issue I am facing. For a few streams, AV sync works fine, but for one particular stream I am having a pretty hard time. Anyways, I will keep my experiments going and try to keep you informed too. GST_DEBUG is also of not much help because GST_DEBUG:3 and above causes crash at random places when I run the code on target.

Well, that seems like a much more serious problem that you should fix
first! If GST_DEBUG isn't working, then there's something seriously
wrong with (probably) lower-level software that gstreamer relies on.
Possibly you've compiled glib incorrectly or something. If you don't
fix that, then you shouldn't expect gstreamer to work correctly at all
- this could easily be the cause of your other crashes.

Mike

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 3gp demux plugin working on PC but not on target

Rahul Verma
In reply to this post by Rahul Verma
Hi,

>You should be able to push a buffer that you have pulled from
>upstream. If you can't, then presumably you're getting your
>refcounting wrong somewhere (or there's some other problem; hard to
>say...). When you just say "got a crash" it's not too helpful - you
>need to at least find out where it's crashing, and why.

Thank you again Mike. As soon as you said refcount, I realised where my mistake was. First was I was doing a unref of the buffer when it was not required. Second, and the more grave mistake was, I was not setting the CAPS for the buffer. I was under the impression CAPS will be taken from the pads, but I was wrong. Now gst_pad_pull_range works brilliantly for me, without any memcpy or delay.

Thanks again.

Rahul Verma
SASKEN BUSINESS DISCLAIMER
-------------------------
This message may contain confidential, proprietary or legally privileged information. In
case you are not the original intended Recipient of the message, you must not, directly or
indirectly, use, Disclose, distribute, print, or copy any part of this message and you are
requested to delete it and inform the sender. Any views expressed in this message are
those of the individual sender unless otherwise stated. Nothing contained in this message
shall be construed as an offer or acceptance of any offer by Sasken Communication
Technologies Limited ("Sasken") unless sent with that express intent and with due
authority of Sasken. Sasken has taken enough precautions to prevent the spread of
viruses. However the company accepts no liability for any damage caused by any virus
transmitted by this email


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel