diff --git a/src/examples/video-play-pull.c b/src/examples/video-play-pull.c index c8c6ea6fc..b831b15e8 100644 --- a/src/examples/video-play-pull.c +++ b/src/examples/video-play-pull.c @@ -284,7 +284,7 @@ on_stream_io_changed(void *_data, uint32_t id, void *area, uint32_t size) static void on_timeout(void *userdata, uint64_t expirations) { struct data *data = userdata; - pw_stream_drive(data->stream); + pw_stream_trigger_process(data->stream); } /* Be notified when the stream param changes. We're only looking at the diff --git a/src/examples/video-src-alloc.c b/src/examples/video-src-alloc.c index c9a5c6c67..8b005a651 100644 --- a/src/examples/video-src-alloc.c +++ b/src/examples/video-src-alloc.c @@ -181,7 +181,7 @@ static void on_timeout(void *userdata, uint64_t expirations) { struct data *data = userdata; pw_log_trace("timeout"); - pw_stream_drive(data->stream); + pw_stream_trigger_process(data->stream); } /* when the stream is STREAMING, start the timer at 40ms intervals diff --git a/src/examples/video-src-reneg.c b/src/examples/video-src-reneg.c index 912179263..673001690 100644 --- a/src/examples/video-src-reneg.c +++ b/src/examples/video-src-reneg.c @@ -185,7 +185,7 @@ static void on_timeout(void *userdata, uint64_t expirations) { struct data *data = userdata; pw_log_trace("timeout"); - pw_stream_drive(data->stream); + pw_stream_trigger_process(data->stream); } /* when the stream is STREAMING, start the timer at 40ms intervals diff --git a/src/examples/video-src.c b/src/examples/video-src.c index 8b15b33e8..6528341e8 100644 --- a/src/examples/video-src.c +++ b/src/examples/video-src.c @@ -178,7 +178,7 @@ static void on_timeout(void *userdata, uint64_t expirations) { struct data *data = userdata; pw_log_trace("timeout"); - pw_stream_drive(data->stream); + pw_stream_trigger_process(data->stream); } static void on_stream_state_changed(void *_data, enum pw_stream_state old, enum pw_stream_state state, diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 37416aba9..68506246a 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -2005,7 +2005,7 @@ int pw_stream_get_time(struct pw_stream *stream, struct pw_time *time) } static int -do_trigger(struct spa_loop *loop, +do_trigger_deprecated(struct spa_loop *loop, bool async, uint32_t seq, const void *data, size_t size, void *user_data) { struct stream *impl = user_data; @@ -2058,7 +2058,7 @@ int pw_stream_queue_buffer(struct pw_stream *stream, struct pw_buffer *buffer) impl->driving && !impl->using_drive) { pw_log_debug("use pw_stream_drive() to drive the stream."); res = pw_loop_invoke(impl->context->data_loop, - do_trigger, 1, NULL, 0, false, impl); + do_trigger_deprecated, 1, NULL, 0, false, impl); } return res; } @@ -2107,7 +2107,7 @@ int pw_stream_flush(struct pw_stream *stream, bool drain) } static int -do_drive(struct spa_loop *loop, +do_trigger_process(struct spa_loop *loop, bool async, uint32_t seq, const void *data, size_t size, void *user_data) { struct stream *impl = user_data; @@ -2123,14 +2123,16 @@ do_drive(struct spa_loop *loop, } SPA_EXPORT -int pw_stream_drive(struct pw_stream *stream) +int pw_stream_trigger_process(struct pw_stream *stream) { struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this); int res = 0; pw_log_trace(NAME" %p", impl); + /* flag to check for old or new behaviour */ impl->using_drive = true; + if (impl->driving) { if (impl->direction == SPA_DIRECTION_OUTPUT && !impl->process_rt) { @@ -2138,7 +2140,7 @@ int pw_stream_drive(struct pw_stream *stream) do_call_process, 1, NULL, 0, false, impl); } res = pw_loop_invoke(impl->context->data_loop, - do_drive, 1, NULL, 0, false, impl); + do_trigger_process, 1, NULL, 0, false, impl); } return res; } diff --git a/src/pipewire/stream.h b/src/pipewire/stream.h index c788521fb..a25ca1938 100644 --- a/src/pipewire/stream.h +++ b/src/pipewire/stream.h @@ -238,7 +238,6 @@ struct pw_stream_events { /** The stream is drained */ void (*drained) (void *data); - }; /** Convert a stream state to a readable string */ @@ -363,9 +362,9 @@ int pw_stream_set_active(struct pw_stream *stream, bool active); * be called when all data is played or recorded */ int pw_stream_flush(struct pw_stream *stream, bool drain); -/** Start a push/pull on the stream. The graph will be started and - * process will be called. Since 0.3.34 */ -int pw_stream_drive(struct pw_stream *stream); +/** Trigger a push/pull on the stream. One iteration of the graph will + * scheduled and process() will be called. Since 0.3.34 */ +int pw_stream_trigger_process(struct pw_stream *stream); /** * \}