mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-05 07:15:34 -04:00
Merge branch 'pulse-samplefix' into 'master'
pulse-server: use timeout also for creating sample-play streams See merge request pipewire/pipewire!2680
This commit is contained in:
commit
4fc294edd8
4 changed files with 29 additions and 1 deletions
|
|
@ -39,6 +39,8 @@
|
||||||
#define MODULE_INDEX_MASK 0xfffffffu
|
#define MODULE_INDEX_MASK 0xfffffffu
|
||||||
#define MODULE_FLAG (1u << 29)
|
#define MODULE_FLAG (1u << 29)
|
||||||
|
|
||||||
|
#define STREAM_CREATE_TIMEOUT (35 * SPA_NSEC_PER_SEC)
|
||||||
|
|
||||||
#define DEFAULT_SINK "@DEFAULT_SINK@"
|
#define DEFAULT_SINK "@DEFAULT_SINK@"
|
||||||
#define DEFAULT_SOURCE "@DEFAULT_SOURCE@"
|
#define DEFAULT_SOURCE "@DEFAULT_SOURCE@"
|
||||||
#define DEFAULT_MONITOR "@DEFAULT_MONITOR@"
|
#define DEFAULT_MONITOR "@DEFAULT_MONITOR@"
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,12 @@
|
||||||
#include <pipewire/properties.h>
|
#include <pipewire/properties.h>
|
||||||
#include <pipewire/stream.h>
|
#include <pipewire/stream.h>
|
||||||
|
|
||||||
|
#include "defs.h"
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "sample.h"
|
#include "sample.h"
|
||||||
#include "sample-play.h"
|
#include "sample-play.h"
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
static void sample_play_stream_state_changed(void *data, enum pw_stream_state old,
|
static void sample_play_stream_state_changed(void *data, enum pw_stream_state old,
|
||||||
enum pw_stream_state state, const char *error)
|
enum pw_stream_state state, const char *error)
|
||||||
|
|
@ -30,17 +32,32 @@ static void sample_play_stream_state_changed(void *data, enum pw_stream_state ol
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case PW_STREAM_STATE_UNCONNECTED:
|
case PW_STREAM_STATE_UNCONNECTED:
|
||||||
case PW_STREAM_STATE_ERROR:
|
case PW_STREAM_STATE_ERROR:
|
||||||
|
pw_timer_queue_cancel(&p->timer);
|
||||||
sample_play_emit_done(p, -EIO);
|
sample_play_emit_done(p, -EIO);
|
||||||
break;
|
break;
|
||||||
case PW_STREAM_STATE_PAUSED:
|
case PW_STREAM_STATE_PAUSED:
|
||||||
p->id = pw_stream_get_node_id(p->stream);
|
p->id = pw_stream_get_node_id(p->stream);
|
||||||
sample_play_emit_ready(p, p->id);
|
sample_play_emit_ready(p, p->id);
|
||||||
break;
|
break;
|
||||||
|
case PW_STREAM_STATE_STREAMING:
|
||||||
|
pw_timer_queue_cancel(&p->timer);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sample_play_start_timeout(void *user_data)
|
||||||
|
{
|
||||||
|
struct sample_play *p = user_data;
|
||||||
|
|
||||||
|
pw_log_info("timeout on sample %s", p->sample->name);
|
||||||
|
|
||||||
|
if (p->stream)
|
||||||
|
pw_stream_set_active(p->stream, false);
|
||||||
|
sample_play_emit_done(p, -ETIMEDOUT);
|
||||||
|
}
|
||||||
|
|
||||||
static void sample_play_stream_destroy(void *data)
|
static void sample_play_stream_destroy(void *data)
|
||||||
{
|
{
|
||||||
struct sample_play *p = data;
|
struct sample_play *p = data;
|
||||||
|
|
@ -163,6 +180,10 @@ struct sample_play *sample_play_new(struct pw_core *core,
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
goto error_cleanup;
|
goto error_cleanup;
|
||||||
|
|
||||||
|
/* Time out if we don't get a link; same timeout as for normal streams */
|
||||||
|
pw_timer_queue_add(sample->impl->timer_queue, &p->timer, NULL,
|
||||||
|
STREAM_CREATE_TIMEOUT, sample_play_start_timeout, p);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
error_cleanup:
|
error_cleanup:
|
||||||
|
|
@ -181,6 +202,8 @@ void sample_play_destroy(struct sample_play *p)
|
||||||
|
|
||||||
spa_hook_list_clean(&p->hooks);
|
spa_hook_list_clean(&p->hooks);
|
||||||
|
|
||||||
|
pw_timer_queue_cancel(&p->timer);
|
||||||
|
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@
|
||||||
#include <spa/utils/list.h>
|
#include <spa/utils/list.h>
|
||||||
#include <spa/utils/hook.h>
|
#include <spa/utils/hook.h>
|
||||||
|
|
||||||
|
#include <pipewire/pipewire.h>
|
||||||
|
|
||||||
struct sample;
|
struct sample;
|
||||||
struct pw_core;
|
struct pw_core;
|
||||||
struct pw_loop;
|
struct pw_loop;
|
||||||
|
|
@ -41,6 +43,7 @@ struct sample_play {
|
||||||
uint32_t offset;
|
uint32_t offset;
|
||||||
uint32_t stride;
|
uint32_t stride;
|
||||||
struct spa_hook_list hooks;
|
struct spa_hook_list hooks;
|
||||||
|
struct pw_timer timer;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ struct stream *stream_new(struct client *client, enum stream_type type, uint32_t
|
||||||
/* Time out if we don't get a link and can't send a reply to create in 35s. Client will time out in
|
/* Time out if we don't get a link and can't send a reply to create in 35s. Client will time out in
|
||||||
* 30s and clean up its stream anyway. */
|
* 30s and clean up its stream anyway. */
|
||||||
pw_timer_queue_add(stream->impl->timer_queue, &stream->timer, NULL,
|
pw_timer_queue_add(stream->impl->timer_queue, &stream->timer, NULL,
|
||||||
35 * SPA_NSEC_PER_SEC, create_stream_timeout, stream);
|
STREAM_CREATE_TIMEOUT, create_stream_timeout, stream);
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue