appsrc and GMainloop problem

Deepak Jain jain1982 at gmail.com
Fri Aug 30 23:26:56 PDT 2013


Hi Tim,

I was able to solve the above problem. It was due to some memory corruption
on my side.

Now, there is another issue:

See, I get the elementary video buffers in a thread, which I am pushing in
appsrc and the rest of pipeline is:

appsrc->h264parse->ffdec_h264->ffmpegcolorspace->videoscale->autovideosink

I am using Gstreamer 0.10


I am pushing buffers like:

            GstBuffer* buf = gst_buffer_new_and_alloc(datalen);
            memcpy(GST_BUFFER_DATA(buf), data, datalen);
            GST_BUFFER_TIMESTAMP(buf) = (pts) * 1000000; (in nanosec)
            gst_app_src_push_buffer(mPlaybackGroup->appsrc, buf);



Now, if I delete the buf after pushing it in appsrc, my video is garbled.
And if I don’t, then it plays perfectly.
So, I am not able to understand when I need to delete the buf, which I am
creating OR appsrc will automatically take care of it?


Even if I am taking a buffer pool of 1000 buffers and deleting first buffer
after allocating thousand and so on, my video starts OK but ultimately gets
garbled at a later stage.


If I dont delete the buffers, then it would led to memory leak in case of
video streaming for long hours.

what could be the solution?

(2) My video playback is gerky although not garbled(with memory leaks as
described above).
What could be the cause of Jerkyness? Any idea?
Since I can not provide both PTS and DTS in Gstreamer 0.10, can it be a
issue?

Thanks,





On Mon, Aug 26, 2013 at 6:33 PM, Deepak Jain <jain1982 at gmail.com> wrote:

> OK...i removed "codec_data" parameter from caps.
> But still I dont know why I am getting same no decoder context error like:
>
> 0:00:09.504370712 10014  0xb384f80 DEBUG                 ffmpeg
> gstffmpegcodecmap.c:2398:gst_ffmpeg_caps_with_codecid: have codec data of
> size 53
> 0:00:09.504388937 10014  0xb384f80 DEBUG                 ffmpeg
> gstffmpegcodecmap.c:2088:gst_ffmpeg_caps_to_pixfmt: converting caps
> video/x-h264, width=(int)320, height=(int)240, parsed=(boolean)true,
> stream-format=(string)avc, alignment=(string)au,
> pixel-aspect-ratio=(fraction)4/3,
> codec_data=(buffer)014d400dffe10025674d400dec80a0fd8750808080a000007d200017701c00002b160002b079351807c50a448001000568ebec6c80
> 0:00:09.504452406 10014  0xb384f80 DEBUG                 ffmpeg
> gstffmpegcodecmap.c:2118:gst_ffmpeg_caps_to_pixfmt: setting
> pixel-aspect-ratio 3/4 = 0.750000
> 0:00:09.504476042 10014  0xb384f80 DEBUG                 ffmpeg
> gstffmpegdec.c:781:gst_ffmpegdec_setcaps:<mydecoder> forcing 25/1 framerate
> 0:00:09.504492294 10014  0xb384f80 DEBUG                 ffmpeg
> gstffmpegdec.c:793:gst_ffmpegdec_setcaps:<mydecoder> sink caps have
> pixel-aspect-ratio of 4:3
> 0:00:09.504509792 10014  0xb384f80 DEBUG                 ffmpeg
> gstffmpegdec.c:811:gst_ffmpegdec_setcaps:<mydecoder> Using framerate from
> codec
> 0:00:09.504522619 10014  0xb384f80 DEBUG                 ffmpeg
> gstffmpegdec.c:818:gst_ffmpegdec_setcaps:<mydecoder> trying to enable
> direct rendering
> 0:00:09.504537396 10014  0xb384f80 DEBUG                 ffmpeg
> gstffmpegdec.c:821:gst_ffmpegdec_setcaps:<mydecoder> disable direct
> rendering setup for H264
> 0:00:09.548427471 10014  0xb384f80 DEBUG                 ffmpeg
> gstffmpegdec.c:895:gst_ffmpegdec_setcaps:<mydecoder:sink> clipping to
> 320x240
> 0:00:09.548465407 10014  0xb384f80 DEBUG                 ffmpeg
> gstffmpegdec.c:904:gst_ffmpegdec_setcaps:<mydecoder:sink> final clipping to
> 320x240
> 0:00:09.548480556 10014  0xb384f80 DEBUG               GST_CAPS
> gstpad.c:2741:gst_pad_set_caps:<mydecoder:sink> caps 0xb376a00
> video/x-h264, width=(int)320, height=(int)240, parsed=(boolean)true,
> stream-format=(string)avc, alignment=(string)au,
> pixel-aspect-ratio=(fraction)4/3,
> codec_data=(buffer)014d400dffe10025674d400dec80a0fd8750808080a000007d200017701c00002b160002b079351807c50a448001000568ebec6c80
> 0:00:09.548699885 10014  0xb384f80 DEBUG                 ffmpeg
> gstffmpegdec.c:2549:gst_ffmpegdec_chain:<mydecoder> received DISCONT
> 0:00:09.548723745 10014  0xb384f80 ERROR                 ffmpeg
> gstffmpegdec.c:2341:gst_ffmpegdec_frame:<mydecoder> no codec context
> 0:00:09.549552644 10014  0xb384f80 DEBUG                 ffmpeg
> gstffmpegdec.c:2566:gst_ffmpegdec_chain:<mydecoder> waiting for keyframe
> 0:00:09.549607984 10014  0xb384f80 DEBUG                 ffmpeg
> gstffmpegdec.c:2571:gst_ffmpegdec_chain:<mydecoder> got keyframe
> 0:00:09.549626379 10014  0xb384f80 ERROR                 ffmpeg
> gstffmpegdec.c:2341:gst_ffmpegdec_frame:<mydecoder> no codec context
>
> As I can see from logs, everything is setting perfectly but still no codec
> context.
> Is it something related to DISCONT?
>
> Thanks for all your help Tim.
>
> Amy be I am very close..just a couple of steps away from actual playback:(
>
>
>
>
> On Mon, Aug 26, 2013 at 3:39 PM, Tim-Philipp Müller <t.i.m at zen.co.uk>wrote:
>
>> On Mon, 2013-08-26 at 12:58 +0530, Deepak Jain wrote:
>>
>> > On appsrc, I am setting Caps as :
>> >
>> >      GstBuffer* buf = gst_buffer_new_and_alloc(extradatalen);
>> >      memcpy(GST_BUFFER_DATA(buf), extradata, extradatalen);
>> >      GstCaps* caps = gst_caps_new_simple ("video/x-h264",
>> >          "codec_data", GST_TYPE_BUFFER, buf,
>> >          "stream-format", G_TYPE_STRING, "byte-stream",
>> >          "width", G_TYPE_INT, <Width>,
>> >          "height", G_TYPE_INT, <Height>,
>> >          "pixel-aspect-ratio", GST_TYPE_FRACTION, <PixelAspectRatioX>,
>> > <PixelAspectRatio>,
>> >          "framerate", GST_TYPE_FRACTION, <RateValue>, <RateScale>,
>> >          NULL);
>> With H.264 in byte-stream format, you should not have codec_data in the
>> caps. Instead, the SPS/PPS should be sent as data in the stream (note:
>> in proper byte-stream format of course).
>>
>> The parser might just assume it's AVC when it sees codec_data.
>>
>> Cheers
>>  -Tim
>>
>>
>> _______________________________________________
>> 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/20130831/9c12c203/attachment.html>


More information about the gstreamer-devel mailing list