appsrc and GMainloop problem

Deepak Jain jain1982 at gmail.com
Mon Aug 26 00:28:43 PDT 2013


I checked with GST_DEBUG=*:5

I am describing the scenario here.

(1) My input H264 ES is a Annex B stream with 0001 as start code
(2) My pipeline is
appsrc->h264parse->ffdec_h264->ffmpegcolorspace->videoscale->autovideosink


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);
     gst_app_src_set_caps(appsrc, caps);
     gst_buffer_unref (buf);
     gst_caps_unref (caps);



Now, when I run my application, for first data buffer of size 3529, I saw
some logs like:

0:00:09.618054032  5068  0xa2c8180 DEBUG      codecparsers_h264
gsth264parser.c:1255:gst_h264_parser_identify_nalu: Nal start 128, No end
found
0:00:09.618081257  5068  0xa2c8180 DEBUG              h264parse
gsth264parse.c:814:gst_h264_parse_check_valid_frame:<myparser> Looking for
more
0:00:09.618107783  5068  0xa2c8180 DEBUG      codecparsers_h264
gsth264parser.c:459:set_nalu_datas: Nal type 5, ref_idc 3
0:00:09.618135333  5068  0xa2c8180 DEBUG      codecparsers_h264
gsth264parser.c:1255:gst_h264_parser_identify_nalu: Nal start 128, No end
found
0:00:09.618154921  5068  0xa2c8180 DEBUG              h264parse
gsth264parse.c:730:gst_h264_parse_check_valid_frame:<myparser> not a
complete nal found at offset 128
0:00:09.618181156  5068  0xa2c8180 DEBUG              baseparse
gstbaseparse.c:2382:gst_base_parse_chain:<myparser> not enough data
available (only 3529 bytes)
0:00:09.618217629  5068  0xa2c8180 DEBUG                basesrc
gstbasesrc.c:2088:gst_base_src_update_length:<mysource> reading offset
3529, length 4096, size -1, segment.stop -1, maxsize -1
0:00:09.618240412  5068  0xa2c8180 DEBUG                basesrc
gstbasesrc.c:2091:gst_base_src_update_length:<mysource> dynamic size: 0
0:00:09.618321779  5068  0xa2c8180 DEBUG                basesrc
gstbasesrc.c:2186:gst_base_src_get_range:<mysource> calling create offset
3529 length 4096, time 0


At byte 128, It h264parse says no end found......I think this is OK since
it is a ANNEX B stream, and a ANNEX B buffer does not end with 0001.
So, are the above debug logs are valid OR their is some problem with the
buffer?




Secondly...if i see the logs more down ....i see these logs


0:00:09.694247554  5068 0xa8869840 DEBUG                 appsrc
gstappsrc.c:1486:gst_app_src_push_buffer_full:<mysource> queueing buffer
0xa2c7b10
0:00:09.706567378  5068  0xa2c8180 DEBUG                 ffmpeg
gstffmpegdec.c:895:gst_ffmpegdec_setcaps:<mydecoder:sink> clipping to
320x240
0:00:09.706609004  5068  0xa2c8180 DEBUG                 ffmpeg
gstffmpegdec.c:904:gst_ffmpegdec_setcaps:<mydecoder:sink> final clipping to
320x240
0:00:09.706623991  5068  0xa2c8180 DEBUG               GST_CAPS
gstpad.c:2741:gst_pad_set_caps:<mydecoder:sink> caps 0xa2c1ba0
video/x-h264,
codec_data=(buffer)014d400dffe10025674d400dec80a0fd8750808080a000007d200017701c00002b160002b079351807c50a448001000568ebec6c80,
stream-format=(string)avc, width=(int)320, height=(int)240,
pixel-aspect-ratio=(fraction)4/3, framerate=(fraction)10000000/417083,
parsed=(boolean)true, alignment=(string)au
0:00:09.706704675  5068  0xa2c8180 DEBUG                 ffmpeg
gstffmpegdec.c:2549:gst_ffmpegdec_chain:<mydecoder> received DISCONT
0:00:09.706726301  5068  0xa2c8180 ERROR                 ffmpeg
gstffmpegdec.c:2341:gst_ffmpegdec_frame:<mydecoder> no codec context
0:00:09.707911411  5068  0xa2c8180 DEBUG                 ffmpeg
gstffmpegdec.c:2566:gst_ffmpegdec_chain:<mydecoder> waiting for keyframe



Above error shows no codec context.
I dont know why this codec context getting not created.

I am pushing the data from the stream to appsrc as I get it, but still dont
know how to get past this error.

Any idea ???


On the other hand...if I dump the stream data in a file and play it with
below pipeline, it works:

gst-launch-0.10 filesrc location=file.264 ! h264parse ! ffdec_h264 !
ffmpegcolorspace ! videoscale ! autovideosink



Dont know why decoder is failing in first case, and why its working in
second case

Thanks
















On Sun, Aug 25, 2013 at 8:36 PM, Tim-Philipp Müller <t.i.m at zen.co.uk> wrote:

> On Fri, 2013-08-23 at 13:01 +0530, Deepak Jain wrote:
>
> >
> appsrc->h264parse->ffdec_h264->ffmpegcolorspace->videoscale->autovideosink
> >
> > Now as I can see, video is properly pushed to appsrc, then to
> > h264parse but no data can be found after ffdec_h264 and nothing
> > happens
> >
> >
> > This I checked by putting filesink first after appsrc, then after
> > h264parse. Both times, I get the data properly
> >
> > But when I put filesink after ffdec_h264, my file shows o bytes.
> >
> > Any idea what I may be missing?
>
> Maybe check the GST_DEBUG=*dec*:6,*ff*:6 debug log, to see if you spot
> anything suspicious. Maybe the decoder is waiting for a buffer marked as
> keyframe, but doesn't get one (and h264parse doesn't actually parse, but
> just passed data through). But that's all just a guess.
>
>  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/20130826/a9aff4ac/attachment-0001.html>


More information about the gstreamer-devel mailing list