mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-02-16 22:05:31 -05:00
stream: return -EIO when doing get_time in != STREAMING
The stream should be streaming before the get_time call is meaningful. Various places in the code already check this an fall back to a default value, we just need to return an error here.
This commit is contained in:
parent
12fb9ab831
commit
11d5e071ec
4 changed files with 8 additions and 5 deletions
|
|
@ -1986,7 +1986,8 @@ int pw_filter_get_time(struct pw_filter *filter, struct pw_time *time)
|
|||
pw_log_trace("%p: %"PRIi64" %"PRIi64" %"PRIu64" %d/%d ", filter,
|
||||
time->now, time->delay, time->ticks,
|
||||
time->rate.num, time->rate.denom);
|
||||
return 0;
|
||||
|
||||
return filter->state == PW_FILTER_STATE_STREAMING ? 0 : -EIO;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
|
|
|
|||
|
|
@ -2504,7 +2504,8 @@ int pw_stream_get_time_n(struct pw_stream *stream, struct pw_time *time, size_t
|
|||
impl->dequeued.outcount, impl->dequeued.incount,
|
||||
impl->queued.outcount, impl->queued.incount,
|
||||
avail_buffers, impl->n_buffers);
|
||||
return 0;
|
||||
|
||||
return stream->state == PW_STREAM_STATE_STREAMING ? 0 : -EIO;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
|
|
|
|||
|
|
@ -293,7 +293,8 @@ struct pw_stream_control {
|
|||
* Use pw_stream_get_time_n() to get an updated time snapshot of the stream.
|
||||
* The time snapshot can give information about the time in the driver of the
|
||||
* graph, the delay to the edge of the graph and the internal queuing in the
|
||||
* stream.
|
||||
* stream. This function should only be called in the STREAMING state and will
|
||||
* return an error when called in any other state.
|
||||
*
|
||||
* pw_time.ticks gives a monotonic increasing counter of the time in the graph
|
||||
* driver. I can be used to generate a timeline to schedule samples as well
|
||||
|
|
@ -594,7 +595,7 @@ const struct pw_stream_control *pw_stream_get_control(struct pw_stream *stream,
|
|||
/** Set control values */
|
||||
int pw_stream_set_control(struct pw_stream *stream, uint32_t id, uint32_t n_values, float *values, ...);
|
||||
|
||||
/** Query the time on the stream, RT safe */
|
||||
/** Query the time on the stream. Returns an error when the stream is not running. RT safe */
|
||||
int pw_stream_get_time_n(struct pw_stream *stream, struct pw_time *time, size_t size);
|
||||
|
||||
/** Get the current time in nanoseconds. This value can be compared with
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ static void test_create(void)
|
|||
/* check id, only when connected */
|
||||
spa_assert_se(pw_stream_get_node_id(stream) == SPA_ID_INVALID);
|
||||
|
||||
spa_assert_se(pw_stream_get_time_n(stream, &tm, sizeof(tm)) == 0);
|
||||
spa_assert_se(pw_stream_get_time_n(stream, &tm, sizeof(tm)) == -EIO);
|
||||
spa_assert_se(tm.now == 0);
|
||||
spa_assert_se(tm.rate.num == 0);
|
||||
spa_assert_se(tm.rate.denom == 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue