mirror of
https://github.com/mpv-player/mpv
synced 2025-03-02 12:20:57 +00:00
Work correctly with very small files where less than outburst is to be played.
patch by Tobias Diedrich, ranma tdiedrich de git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27467 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
a42593f347
commit
5a4496ca5d
@ -574,6 +574,29 @@ static int play(void* data,int len,int flags)
|
||||
if (len == 0)
|
||||
return 0;
|
||||
|
||||
if (len < ao_data.outburst) {
|
||||
unsigned tempbufsz = ao_data.outburst;
|
||||
void *tempbuf = malloc(tempbufsz);
|
||||
|
||||
memset(tempbuf, 0, tempbufsz);
|
||||
memcpy(tempbuf, data, len);
|
||||
|
||||
play(tempbuf, ao_data.outburst, flags);
|
||||
|
||||
if (nas_data->state != AuStateStart) {
|
||||
mp_msg(MSGT_AO, MSGL_DBG2, "ao_nas: play(): Starting flow.\n");
|
||||
nas_data->expect_underrun = 1;
|
||||
nas_data->state = AuStateStart;
|
||||
AuStartFlow(nas_data->aud, nas_data->flow, &as);
|
||||
if (as != AuSuccess)
|
||||
nas_print_error(nas_data->aud, "play(): AuStartFlow", as);
|
||||
}
|
||||
|
||||
free(tempbuf);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&nas_data->buffer_mutex);
|
||||
maxbursts = (nas_data->client_buffer_size -
|
||||
nas_data->client_buffer_used) / ao_data.outburst;
|
||||
|
Loading…
Reference in New Issue
Block a user