Hi all,<br>
<br>
I think there's a problem with the way the newsegment event in handled in gstffmpecdec.c <br>
in : gst_ffmpegdec_sink_event (GstPad * pad, GstEvent * event) (in HEAD)<br>
<br>
I see : &nbsp; case GST_EVENT_NEWSEGMENT: { ....<br>
<br>
&nbsp;if (ffmpegdec-&gt;opened) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; avcodec_flush_buffers (ffmpegdec-&gt;context);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (ffmpegdec-&gt;context-&gt;codec_id == CODEC_ID_MPEG2VIDEO ||<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ffmpegdec-&gt;context-&gt;codec_id == CODEC_ID_MPEG4 ||<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ffmpegdec-&gt;context-&gt;codec_id == CODEC_ID_H264) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ffmpegdec-&gt;waiting_for_key = TRUE;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ffmpegdec-&gt;waiting_for_key = TRUE;<br>
<br>
With this code waiting_for_key will always be set to TRUE ... so why is
there the condition with the codecs_ids ? and why is it set to
true&nbsp; when it's most codecs don't require it ?&nbsp; I guessed
since these formats could be streamed the waiting_for_key should be
false there and there should be an other conditions so that the second
isn't executed... <br>
<br>
Or it's the opposite while it's not opened waiting_for_key should be
false and then set true when opened for the selected codecs... That
would be more logical and I think that's the way to do it but i'm just
wondering why then would someone have placed MPEG4 and H264 there when
they don't need a keyframe...?<br>
<br>
To me this should be written like :<br>
<br>
<br>
if (ffmpegdec-&gt;opened) {<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; avcodec_flush_buffers (ffmpegdec-&gt;context);<br>

<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if
(ffmpegdec-&gt;context-&gt;codec_id == CODEC_ID_MPEG2VIDEO || other
coded which requires keyframes )<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ffmpegdec-&gt;waiting_for_key = TRUE;<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ffmpegdec-&gt;waiting_for_key = FALSE;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
}<br>
else {<br>
 ffmpegdec-&gt;waiting_for_key = FALSE;<br>
}<br>
<br>
Note that I realise this might be done so that when seeking you
directly get a keyframe ,, but since newsegment is always sent before
the 1st buffer is sent it has the effect that waiting_for_key is always
set to TRUE at 1st .. so if you have a stream with 1 keyframe at start
and then no other keyframes you will never be able to play it if you
start at frame 2, even if you should be able to and do we really need
to get a keyframe direclty ?<br>
<br>
Thanks a lot<br>
<br>
Antoine<br>
<br>
<br>
<br>
<br>