screencast: improve logging for pipewire events

We should log buffer add and remove events in the debug loglevel, since
they signal starts, stops and renegotiations of the buffer transfer.
Additionaly logging the negotiated pwr_format should help classify
issues from the DEBUG loglevel.
This commit is contained in:
columbarius 2022-03-05 12:35:46 +01:00
parent 852e1c95c7
commit 6cec421f92

View file

@ -182,6 +182,13 @@ static void pwr_handle_stream_param_changed(void *data, uint32_t id,
data_type = 1<<SPA_DATA_MemFd;
}
logprint(DEBUG, "pipewire: Format negotiated:");
logprint(DEBUG, "pipewire: buffer_type: %u (%u)", cast->buffer_type, data_type);
logprint(DEBUG, "pipewire: format: %u", cast->pwr_format.format);
logprint(DEBUG, "pipewire: modifier: %lu", cast->pwr_format.modifier);
logprint(DEBUG, "pipewire: size: (%u, %u)", cast->pwr_format.size.width, cast->pwr_format.size.height);
logprint(DEBUG, "pipewire: max_framerate: (%u / %u)", cast->pwr_format.max_framerate.num, cast->pwr_format.max_framerate.denom);
params[0] = build_buffer(&b, blocks, cast->screencopy_frame_info[cast->buffer_type].size,
cast->screencopy_frame_info[cast->buffer_type].stride, data_type);
@ -197,7 +204,7 @@ static void pwr_handle_stream_add_buffer(void *data, struct pw_buffer *buffer) {
struct xdpw_screencast_instance *cast = data;
struct spa_data *d;
logprint(TRACE, "pipewire: add buffer event handle");
logprint(DEBUG, "pipewire: add buffer event handle");
d = buffer->buffer->datas;
@ -244,7 +251,7 @@ static void pwr_handle_stream_add_buffer(void *data, struct pw_buffer *buffer) {
static void pwr_handle_stream_remove_buffer(void *data, struct pw_buffer *buffer) {
struct xdpw_screencast_instance *cast = data;
logprint(TRACE, "pipewire: remove buffer event handle");
logprint(DEBUG, "pipewire: remove buffer event handle");
struct xdpw_buffer *xdpw_buffer = buffer->user_data;
if (xdpw_buffer) {
@ -313,8 +320,11 @@ void xdpw_pwr_enqueue_buffer(struct xdpw_screencast_instance *cast) {
logprint(TRACE, "********************");
logprint(TRACE, "pipewire: fd %u", d[0].fd);
logprint(TRACE, "pipewire: size %d", d[0].maxsize);
logprint(TRACE, "pipewire: maxsize %d", d[0].maxsize);
logprint(TRACE, "pipewire: size %d", d[0].chunk->size);
logprint(TRACE, "pipewire: stride %d", d[0].chunk->stride);
logprint(TRACE, "pipewire: offset %d", d[0].chunk->offset);
logprint(TRACE, "pipewire: chunk flags %d", d[0].chunk->flags);
logprint(TRACE, "pipewire: width %d", cast->current_frame.xdpw_buffer->width);
logprint(TRACE, "pipewire: height %d", cast->current_frame.xdpw_buffer->height);
logprint(TRACE, "pipewire: y_invert %d", cast->current_frame.y_invert);