0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

demux_raw: read multiple frames per packet

The rawaudio demuxer read one frame per packet, basically a few bytes,
which caused insane overhead. (I found this when I couldn't play raw
audio without dropouts when using -v, which printed a line per packet
read.)

Fix this and read 1 second of audio per packet. This is a regression
since cfa5712 (merging of demux_rawaudio and demux_rawvideo).
This commit is contained in:
wm4 2013-08-22 18:56:19 +02:00
parent cd7ec016e7
commit 6f86affef5

View File

@ -35,6 +35,7 @@
struct priv {
int frame_size;
int read_frames;
double frame_rate;
};
@ -107,6 +108,7 @@ static int demux_rawaudio_open(demuxer_t *demuxer, enum demux_check check)
*p = (struct priv) {
.frame_size = samplesize * sh_audio->channels.num,
.frame_rate = samplerate,
.read_frames = samplerate,
};
return 0;
@ -191,6 +193,7 @@ static int demux_rawvideo_open(demuxer_t *demuxer, enum demux_check check)
*p = (struct priv) {
.frame_size = imgsize,
.frame_rate = fps,
.read_frames = 1,
};
return 0;
@ -203,7 +206,7 @@ static int raw_fill_buffer(demuxer_t *demuxer)
if (demuxer->stream->eof)
return 0;
struct demux_packet *dp = new_demux_packet(p->frame_size);
struct demux_packet *dp = new_demux_packet(p->frame_size * p->read_frames);
dp->pos = stream_tell(demuxer->stream) - demuxer->movi_start;
dp->pts = (dp->pos / p->frame_size) / p->frame_rate;