Hi Edward and All, Please give your kind help.
last week, I raised the question about "question about seek on HTTP wav stream over either neonhttpsrc or gnomevfssrc."
thanks Edward respond with below advices, i tried these steps, but seems there are problem too.
Just make sure i understand this advice well, i attached my codes and logs at the end of mail:
the steps from Edward:
This is not specific to http, but common to any non-live pipeline. The
problem is that the state change to PAUSED/PLAYING happens
asynchronously. What you want to do is the following:
* set state to PAUSED
* WAIT (in the mainloop or polling) for the confirmation that the
pipeline has changed state to PAUSED. This means that all sinks are
prerolled (one buffer is waiting in each sink) and the pipeline is fully
responsive to seeks/playback/...
* Do your seek.
* You don't need to wait for the pipeline to be pre-rolled (PAUSED)
again to set it to PLAYING, you can straight away set it to PLAYING.
You might also want to listen for ERROR/EOS messages on the pipeline
bus, because although the remote http uri accepts seeks according to its
headers (which is why the seek would return True), many things could go
wrong in between also.
- Edward
This question cause me several days without final idea.
My purpose is to seek on HTTP wav stream over either neonhttpsrc or
gnomevfssrc(, maybe there are other plugin).
But the problem is seek cannot jump to the position which i want to seek and
cannot change the state.
with error:
<neonhttpsrc> pausing after gst_pad_push() = wrong-state
basesink gstbasesink.c:2099:gst_base_sink_render_object:<alsasink0> do_sync
returned wrong-state
I first give my codes logic, then with the debug logs.
The gst version on my FEDORA 8
gstreamer.i386 0.10.15-1.fc8 installed
gstreamer-devel.i386 0.10.15-1.fc8 installed
gstreamer-ffmpeg.i386 0.10.3-7.fc8 installed
gstreamer-plugins-bad.i386 0.10.5-16.fc8 installed
gstreamer-plugins-base.i386 0.10.15-4.fc8 installed
gstreamer-plugins-base-devel.i386 0.10.15-4.fc8 installed
gstreamer-plugins-good.i386 0.10.6-7.fc8 installed
gstreamer-plugins-pulse.i386 0.9.5-0.4.svn20070924. installed
gstreamer-plugins-ugly.i386 0.10.6-6.fc8 installed
gstreamer-python.i386 0.10.8-2.fc8 installed
gstreamer-tools.i386 0.10.15-1.fc8 installed
codes logic:
-------------------------------------------------------------------------------------------
const char *src_name = "neonhttpsrc";
memset(&(renderer->audioDecoder), 0, sizeof(renderer->audioDecoder));
memset(pHttpDecoder, 0, sizeof(*pHttpDecoder));
renderer->selectionFlag |= pkSTREAM_SELECTION_FLAG_AUDIO;
renderer->audioDecoder.pipeline =
gst_pipeline_new("pcm-decoder-over-http");
//1. open src:
pHttpDecoder->fakesrc = gst_element_factory_make(src_name,src_name);
if(!(pHttpDecoder->fakesrc))
{
}
g_object_set (G_OBJECT (pHttpDecoder->fakesrc), "location", pcszUrl,
NULL);
//2. open wavparse
pHttpDecoder->decoder = gst_element_factory_make("wavparse",
"wavparse0");
//3. open audioconvert
pHttpDecoder->convert = gst_element_factory_make("audioconvert",
"audioconvert0");
//4. open audioconvert
pHttpDecoder->aresample = gst_element_factory_make("audioresample",
"audioresample0");
//5. open alsasink
pHttpDecoder->audiosink = gst_element_factory_make("alsasink",
"alsasink0");
/* Setup pipeline */
gst_bin_add_many(GST_BIN(renderer->audioDecoder.pipeline),
pHttpDecoder->fakesrc,
pHttpDecoder->decoder,
pHttpDecoder->convert,
pHttpDecoder->aresample,
pHttpDecoder->audiosink, NULL);
gst_element_link_many(pHttpDecoder->fakesrc, pHttpDecoder->decoder,
NULL);
gst_element_link_many(pHttpDecoder->decoder, pHttpDecoder->convert,
NULL);
g_signal_connect(pHttpDecoder->decoder, "pad-added",
G_CALLBACK(NewPad_Cb), pHttpDecoder->convert);
gst_element_link_many(pHttpDecoder->convert, pHttpDecoder->aresample,
pHttpDecoder->audiosink, NULL);
gst_element_set_state(pipeline, GST_STATE_PAUSED);
for(index=0; index < 5; index++)
{
gst_element_get_state (pipeline, &cur_state, NULL, 1 * GST_SECOND);
if ( WaitchangeToState != cur_state )
{}
else
{break;}
}
// begin seek.
b_seek_result = gst_element_seek (audiosink, 1.0, format, SeekFlags ,
GST_SEEK_TYPE_SET, time_nanoseconds,
GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
gst_element_set_state(hRenderer->audioDecoder.pipeline,
GST_STATE_PLAYING);
-------------------------------------------------------------------------------------------
logs:
-------------------------------------------------------------------------------------------
0:00:26.600566000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:1718:gst_base_sink_do_sync:<alsasink0> non syncable object
0x8ccb278
0:00:26.600574000 32405 0x8cb5560 DEBUG GST_EVENT
gstpad.c:4214:gst_pad_send_event:<audioresample0:sink> have event type 19
(FLUSH_START)
0:00:26.600577000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:2057:gst_base_sink_render_object:<alsasink0> rendering event
0x8ccb278, type newsegment
0:00:26.600584000 32405 0x8cb5560 DEBUG GST_EVENT
gstpad.c:4220:gst_pad_send_event:<audioresample0:sink> set flush flag
0:00:26.600589000 32405 0xb9dc3e0 DEBUG baseaudiosink
gstbaseaudiosink.c:629:gst_base_audio_sink_event:<alsasink0> new segment
rate of 1.000000
0:00:26.600596000 32405 0x8cb5560 DEBUG GST_EVENT
gstpad.c:4214:gst_pad_send_event:<alsasink0:sink> have event type 19
(FLUSH_START)
0:00:26.600610000 32405 0x8cb5560 DEBUG GST_EVENT
gstpad.c:4220:gst_pad_send_event:<alsasink0:sink> set flush flag
0:00:26.600606000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:1122:gst_base_sink_configure_segment:<alsasink0> configured
NEWSEGMENT update 0, rate 1.000000, applied rate 1.000000, format
GST_FORMAT_TIME, 0:00:00.000000000 -- 0:04:42.906660998, time
0:00:00.000000000, accum 0:00:00.000000000
0:00:26.600623000 32405 0x8cb5560 DEBUG basesink
gstbasesink.c:2309:gst_base_sink_event:<alsasink0> event 0x8ccb2c8
(flush-start)
0:00:26.600639000 32405 0x8cb5560 DEBUG ringbuffer
gstringbuffer.c:1112:gst_ring_buffer_clear_all:<audiosinkringbuffer0> clear
all segments
0:00:26.600641000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:2091:gst_base_sink_render_object:<alsasink0> object unref
after render 0x8ccb278
0:00:26.600661000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:2215:gst_base_sink_queue_object_unlocked:<alsasink0> rendering
queued object 0x8d054a0
0:00:26.600662000 32405 0x8cb5560 DEBUG ringbuffer
gstringbuffer.c:866:gst_ring_buffer_pause_unlocked:<audiosinkringbuffer0>
pausing ringbuffer
0:00:26.600674000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:1718:gst_base_sink_do_sync:<alsasink0> non syncable object
0x8d054a0
0:00:26.600680000 32405 0x8cb5560 DEBUG ringbuffer
gstringbuffer.c:895:gst_ring_buffer_pause_unlocked:<audiosinkringbuffer0>
was not started
0:00:26.600684000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:2057:gst_base_sink_render_object:<alsasink0> rendering event
0x8d054a0, type tag
0:00:26.600690000 32405 0x8cb5560 DEBUG basesink
gstbasesink.c:2375:gst_base_sink_event:<alsasink0> flush-start 0x8ccb2c8
0:00:26.600694000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:2091:gst_base_sink_render_object:<alsasink0> object unref
after render 0x8d054a0
0:00:26.600751000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:1344:gst_base_sink_get_sync_times:<alsasink0> got times start:
0:00:00.000000000, stop: 0:00:00.023219955, do_sync 0
0:00:26.600764000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:1653:gst_base_sink_do_sync:<alsasink0> prerolling object
0xb9ddca0
0:00:26.600777000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:1506:gst_base_sink_wait_preroll:<alsasink0> waiting in preroll
for flush or PLAYING
0:00:26.600792000 32405 0x8cb5560 DEBUG basesink
gstbasesink.c:2713:gst_base_sink_set_flushing:<alsasink0> flushing out data
thread, need preroll to TRUE
0:00:26.600802000 32405 0x8cb5560 DEBUG basesink
gstbasesink.c:1067:gst_base_sink_preroll_queue_flush:<alsasink0> flushing
queue 0xb9ac040
0:00:26.600820000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:1519:gst_base_sink_wait_preroll:<alsasink0> preroll
interrupted
0:00:26.600830000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:1723:gst_base_sink_do_sync:<alsasink0> we are flushing
0:00:26.600839000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:2099:gst_base_sink_render_object:<alsasink0> do_sync returned
wrong-state
0:00:26.600848000 32405 0xb9dc3e0 DEBUG basesink
gstbasesink.c:2091:gst_base_sink_render_object:<alsasink0> object unref
after render 0xb9ddca0
0:00:26.600862000 32405 0xb9dc3e0 WARN wavparse
gstwavparse.c:1645:gst_wavparse_stream_data:<wavparse0> Error pushing on
srcpad 0xb99e630, is linked? = 1
0:00:26.600873000 32405 0xb9dc3e0 INFO basesrc
gstbasesrc.c:2054:gst_base_src_loop:<neonhttpsrc> pausing after
gst_pad_push() = wrong-state
0:00:26.600885000 32405 0xb9dc3e0 DEBUG basesrc
gstbasesrc.c:2080:gst_base_src_loop:<neonhttpsrc> pausing task, reason
wrong-state
0:00:26.600887000 32405 0x8cb5560 DEBUG GST_STATES
gstelement.c:2209:gst_element_lost_state:<alsasink0> lost state of PAUSED to
PAUSED
0:00:26.600900000 32405 0xb9dc3e0 DEBUG GST_PADS
gstpad.c:4394:gst_pad_pause_task:<neonhttpsrc:src> pause task
0:00:26.600912000 32405 0xb9dc3e0 DEBUG task
gsttask.c:476:gst_task_pause:<task0> Pausing task 0xb859948
0:00:26.600910000 32405 0x8cb5560 DEBUG GST_BUS
gstbus.c:337:gst_bus_post:<bus0> [msg 0x8d0e158] posting on bus, type
state-changed, GstMessageState, old-state=(GstState)GST_STATE_PAUSED,
new-state=(GstState)GST_STATE_PAUSED,
pending-state=(GstState)GST_STATE_PAUSED; from source <alsasink0>
0:00:26.600939000 32405 0x8cb5560 DEBUG bin
gstbin.c:2699:gst_bin_handle_message_func:<pcm-decoder-over-http> [msg
0x8d0e158] handling child alsasink0 message of type state-changed
0:00:26.600949000 32405 0x8cb5560 DEBUG bin
gstbin.c:2903:gst_bin_handle_message_func:<pcm-decoder-over-http> posting
message upward
0:00:26.600960000 32405 0x8cb5560 DEBUG GST_BUS
gstbus.c:337:gst_bus_post:<bus1> [msg 0x8d0e158] posting on bus, type
state-changed, GstMessageState, old-state=(GstState)GST_STATE_PAUSED,
new-state=(GstState)GST_STATE_PAUSED,
pending-state=(GstState)GST_STATE_PAUSED; from source <alsasink0>
0:00:26.600986000 32405 0x8cb5560 DEBUG GST_BUS
gstbus.c:367:gst_bus_post:<bus1> [msg 0x8d0e158] pushing on async queue
0:00:26.600998000 32405 0x8cb5560 DEBUG GST_BUS
gstbus.c:372:gst_bus_post:<bus1> [msg 0x8d0e158] pushed on async queue
0:00:26.601008000 32405 0x8cb5560 DEBUG GST_BUS
gstbus.c:363:gst_bus_post:<bus0> [msg 0x8d0e158] dropped
0:00:26.601022000 32405 0x8cb5560 DEBUG GST_BUS
gstbus.c:337:gst_bus_post:<bus0> [msg 0x8d0e198] posting on bus, type
async-start, GstMessageAsyncStart, new-base-time=(boolean)true; from source
<alsasink0>
0:00:26.601043000 32405 0x8cb5560 DEBUG pipeline
gstpipeline.c:326:reset_stream_time:<pcm-decoder-over-http> reset
stream_time to 0
0:00:26.601053000 32405 0x8cb5560 DEBUG bin
gstbin.c:2699:gst_bin_handle_message_func:<pcm-decoder-over-http> [msg
0x8d0e198] handling child alsasink0 message of type async-start
0:00:26.601065000 32405 0x8cb5560 DEBUG bin
gstbin.c:2833:gst_bin_handle_message_func:<pcm-decoder-over-http>
ASYNC_START message 0x8d0e198, alsasink0
0:00:26.601075000 32405 0x8cb5560 DEBUG bin
gstbin.c:739:find_message:<pcm-decoder-over-http> no message found matching
types 00100000
0:00:26.601085000 32405 0x8cb5560 DEBUG bin
gstbin.c:775:bin_replace_message:<pcm-decoder-over-http> got new message
0x8d0e198, async-start from alsasink0
0:00:26.601095000 32405 0x8cb5560 DEBUG GST_STATES
gstbin.c:2464:bin_handle_async_start:<pcm-decoder-over-http> lost state of
PAUSED, new PAUSED
0:00:26.601109000 32405 0x8cb5560 DEBUG GST_BUS
gstbus.c:337:gst_bus_post:<bus1> [msg 0x8d0e1d8] posting on bus, type
state-changed, GstMessageState, old-state=(GstState)GST_STATE_PAUSED,
new-state=(GstState)GST_STATE_PAUSED,
pending-state=(GstState)GST_STATE_PAUSED; from source
<pcm-decoder-over-http>
0:00:26.601136000 32405 0x8cb5560 DEBUG GST_BUS
gstbus.c:367:gst_bus_post:<bus1> [msg 0x8d0e1d8] pushing on async queue
0:00:26.601146000 32405 0x8cb5560 DEBUG GST_BUS
gstbus.c:372:gst_bus_post:<bus1> [msg 0x8d0e1d8] pushed on async queue
0:00:26.601158000 32405 0x8cb5560 DEBUG GST_BUS
gstbus.c:363:gst_bus_post:<bus0> [msg 0x8d0e198] dropped
0:00:26.601172000 32405 0x8cb5560 DEBUG GST_PADS
gstpad.c:4261:gst_pad_send_event:<alsasink0:sink> sent event, result 1
0:00:26.601183000 32405 0x8cb5560 DEBUG GST_PADS
gstpad.c:4261:gst_pad_send_event:<audioresample0:sink> sent event, result 1
0:00:26.601193000 32405 0x8cb5560 DEBUG GST_PADS
gstpad.c:4261:gst_pad_send_event:<audioconvert0:sink> sent event, result 1
0:00:26.601202000 32405 0x8cb5560 DEBUG wavparse
gstwavparse.c:800:gst_wavparse_perform_seek:<wavparse0> stopped streaming at
23219955
0:00:26.601212000 32405 0x8cb5560 DEBUG wavparse
gstwavparse.c:809:gst_wavparse_perform_seek:<wavparse0> configuring seek
0:00:26.601221000 32405 0x8cb5560 DEBUG wavparse
gstwavparse.c:819:gst_wavparse_perform_seek:<wavparse0> cur_type =2
0:00:26.601244000 32405 0x8cb5560 DEBUG query
gstquery.c:371:gst_query_new: creating new query 0x8d9b4e0 2
0:00:26.601256000 32405 0x8cb5560 DEBUG GST_PADS
gstpad.c:3053:gst_pad_query:<neonhttpsrc:src> sending query 0x8d9b4e0
0:00:26.601268000 32405 0x8cb5560 DEBUG basesrc
gstbasesrc.c:776:gst_base_src_default_query:<neonhttpsrc> duration query in
format bytes
0:00:26.601283000 32405 0x8cb5560 DEBUG basesrc
gstbasesrc.c:884:gst_base_src_default_query:<neonhttpsrc> query duration
returns 1
0:00:26.601295000 32405 0x8cb5560 DEBUG wavparse
gstwavparse.c:868:gst_wavparse_perform_seek:<wavparse0> seek: offset
17992828, end 49904764, segment 0:01:42.000000000 -- 0:04:42.906660998
0:00:26.601307000 32405 0x8cb5560 DEBUG wavparse
gstwavparse.c:874:gst_wavparse_perform_seek:<wavparse0> sending flush stop
0:00:26.601317000 32405 0x8cb5560 DEBUG GST_EVENT
gstevent.c:286:gst_event_new: creating new event 0x8ccb2f0 flush-stop 39
0:00:26.601329000 32405 0x8cb5560 DEBUG GST_EVENT
gstpad.c:4224:gst_pad_send_event:<audioconvert0:sink> cleared flush flag
0:00:26.601341000 32405 0x8cb5560 DEBUG GST_EVENT
gstpad.c:4224:gst_pad_send_event:<audioresample0:sink> cleared flush flag
0:00:26.601351000 32405 0x8cb5560 DEBUG libaudioresample
resample.c:130:resample_input_flush: flush
0:00:26.601364000 32405 0x8cb5560 DEBUG GST_EVENT
gstpad.c:4224:gst_pad_send_event:<alsasink0:sink> cleared flush flag
0:00:26.601374000 32405 0x8cb5560 DEBUG basesink
gstbasesink.c:2309:gst_base_sink_event:<alsasink0> event 0x8ccb2f0
(flush-stop)
0:00:26.601384000 32405 0x8cb5560 DEBUG ringbuffer
gstringbuffer.c:1112:gst_ring_buffer_clear_all:<audiosinkringbuffer0> clear
all segments
0:00:26.601399000 32405 0x8cb5560 DEBUG basesink
gstbasesink.c:2404:gst_base_sink_event:<alsasink0> flush-stop 0x8ccb2f0
0:00:26.601413000 32405 0x8cb5560 DEBUG GST_PADS
gstpad.c:4261:gst_pad_send_event:<alsasink0:sink> sent event, result 1
0:00:26.601424000 32405 0x8cb5560 DEBUG GST_PADS
gstpad.c:4261:gst_pad_send_event:<audioresample0:sink> sent event, result 1
0:00:26.601442000 32405 0x8cb5560 DEBUG GST_PADS
gstpad.c:4261:gst_pad_send_event:<audioconvert0:sink> sent event, result 1
0:00:26.601451000 32405 0x8cb5560 DEBUG wavparse
gstwavparse.c:906:gst_wavparse_perform_seek:<wavparse0> Creating newsegment
from 102000000000 to 282906660998
0:00:26.601463000 32405 0x8cb5560 INFO GST_EVENT
gstevent.c:528:gst_event_new_new_segment_full: creating newsegment update 0,
rate 1.000000, format GST_FORMAT_TIME, start 0:01:42.000000000, stop
0:04:42.906660998, position 0:01:42.000000000
0:00:26.601482000 32405 0x8cb5560 DEBUG GST_EVENT
gstevent.c:286:gst_event_new: creating new event 0x8ccb318 newsegment 102
0:00:26.601495000 32405 0x8cb5560 DEBUG wavparse
gstwavparse.c:918:gst_wavparse_perform_seek:<wavparse0> mark DISCONT, we did
a seek to another position
0:00:26.601508000 32405 0x8cb5560 DEBUG GST_PADS
gstpad.c:4261:gst_pad_send_event:<wavparse0:src> sent event, result 1
0:00:26.601526000 32405 0x8cb5560 DEBUG GST_PADS
gstpad.c:4261:gst_pad_send_event:<audioconvert0:src> sent event, result 1
0:00:26.601539000 32405 0x8cb5560 DEBUG GST_PADS
gstpad.c:4261:gst_pad_send_event:<audioresample0:src> sent event, result 1
():Line[2361]: Seek success!
():LINE[2507] seeking returned result 0
0:00:26.601558000 32405 0x8cb5560 DEBUG GST_STATES
gstelement.c:2283:gst_element_set_state_func:<pcm-decoder-over-http>
set_state to PLAYING
0:00:26.601568000 32405 0x8cb5560 DEBUG GST_STATES
gstelement.c:2319:gst_element_set_state_func:<pcm-decoder-over-http> current
PAUSED, old_pending PAUSED, next PAUSED, old return ASYNC
0:00:26.601579000 32405 0x8cb5560 DEBUG GST_STATES
gstelement.c:2373:gst_element_set_state_func:<pcm-decoder-over-http> element
was busy with async state change
0:00:26.601591000 32405 0x8cb5560 INFO GST_STATES
gstbin.c:1537:gst_bin_get_state_func:<pcm-decoder-over-http> getting state
0:00:26.601600000 32405 0x8cb5560 DEBUG GST_STATES
gstelement.c:1840:gst_element_get_state_func:<pcm-decoder-over-http> getting
state, timeout 0:00:01.000000000
0:00:26.601615000 32405 0x8cb5560 DEBUG GST_STATES
gstelement.c:1845:gst_element_get_state_func:<pcm-decoder-over-http> RETURN
is ASYNC
0:00:26.601625000 32405 0x8cb5560 INFO GST_STATES
gstelement.c:1881:gst_element_get_state_func:<pcm-decoder-over-http> waiting
for element to commit state
0:00:27.601655000 32405 0x8cb5560 INFO GST_STATES
gstelement.c:1885:gst_element_get_state_func:<pcm-decoder-over-http> timed
out
0:00:27.601688000 32405 0x8cb5560 DEBUG GST_STATES
gstelement.c:1918:gst_element_get_state_func:<pcm-decoder-over-http> state
current: PAUSED, pending: PLAYING, result: ASYNC
():Line[2512]: cur_state is 3
returned with retVal 0x(0)
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel