cache: fix --cache-initial status message

For quite some time, msg.c hasn't output partial log messages anymore,
and instead buffered them in memory. This means the MP_INFO() statement
here just kept appending the message to memory, instead of outputting
it.

Easy enough to fix by abusing the status line (which means the frontend
and this code will "fight" for the status line, but this code seems to
win usually, as the frontend doesn't update it so often).

Users should probably really switch to --cache-pause-initial.

Fixes #5360.
This commit is contained in:
wm4 2018-01-06 15:55:13 +01:00 committed by Kevin Mitchell
parent ebe0f5d313
commit 6632d6e287
1 changed files with 3 additions and 4 deletions

View File

@ -790,8 +790,8 @@ int stream_cache_init(stream_t *cache, stream_t *stream,
struct stream_cache_info info; struct stream_cache_info info;
if (stream_control(s->cache, STREAM_CTRL_GET_CACHE_INFO, &info) < 0) if (stream_control(s->cache, STREAM_CTRL_GET_CACHE_INFO, &info) < 0)
break; break;
MP_INFO(s, "\rCache fill: %5.2f%% " mp_msg(s->log, MSGL_STATUS, "Cache fill: %5.2f%% "
"(%" PRId64 " bytes) ", 100.0 * info.fill / s->buffer_size, "(%" PRId64 " bytes)", 100.0 * info.fill / s->buffer_size,
info.fill); info.fill);
if (info.fill >= min) if (info.fill >= min)
break; break;
@ -804,6 +804,5 @@ int stream_cache_init(stream_t *cache, stream_t *stream,
cache_wakeup_and_wait(s, &(double){0}); cache_wakeup_and_wait(s, &(double){0});
pthread_mutex_unlock(&s->mutex); pthread_mutex_unlock(&s->mutex);
} }
MP_INFO(s, "\n");
return 1; return 1;
} }