mirror of
https://github.com/mpv-player/mpv
synced 2025-01-30 03:32:50 +00: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:
parent
cd7ec016e7
commit
6f86affef5
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user