1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-01 23:00:41 +00:00

Another small simplification. Slightly worse performance in the case

where a buffer underrun happens, but this really should not matter.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25676 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2008-01-11 20:36:33 +00:00
parent 023340d6bd
commit c706a93140

View File

@ -120,6 +120,8 @@ static int write_buffer(unsigned char* data, int len) {
return len; return len;
} }
static void silence(float **bufs, int cnt, int num_bufs);
/** /**
* \brief read data from buffer and splitting it into channels * \brief read data from buffer and splitting it into channels
* \param bufs num_bufs float buffers, each will contain the data of one channel * \param bufs num_bufs float buffers, each will contain the data of one channel
@ -137,10 +139,8 @@ static int read_buffer(float **bufs, int cnt, int num_bufs) {
int buffered = buf_used(); int buffered = buf_used();
int i, j; int i, j;
if (cnt * sizeof(float) * num_bufs > buffered) { if (cnt * sizeof(float) * num_bufs > buffered) {
int orig_cnt = cnt; silence(bufs, cnt, num_bufs);
cnt = buffered / sizeof(float) / num_bufs; cnt = buffered / sizeof(float) / num_bufs;
for (i = 0; i < num_bufs; i++)
memset(&bufs[i][cnt], 0, (orig_cnt - cnt) * sizeof(float));
} }
for (i = 0; i < cnt; i++) { for (i = 0; i < cnt; i++) {
for (j = 0; j < num_bufs; j++) { for (j = 0; j < num_bufs; j++) {