summaryrefslogtreecommitdiff
path: root/libavdevice/oss_dec.c
diff options
context:
space:
mode:
authorMatt Jacobson <mhjacobson@me.com>2022-06-01 05:06:16 -0400
committerMarton Balint <cus@passwd.hu>2022-06-19 23:01:20 +0200
commitb3e261bab381f43ab5f842725d30479d511d1111 (patch)
tree9701150e05f1c2a7c6147023d04bc8aab8d40c8f /libavdevice/oss_dec.c
parentfee765c2078ba03e346e311c86a447a116fe8c5f (diff)
downloadffmpeg-b3e261bab381f43ab5f842725d30479d511d1111.tar.gz
avdevice/oss_dec: account for sample size when computing timestamp
Don't assume each sample is one byte in size. Doing so results in wrong and occasionally non-monotonically-increasing timestamps. Fix nearby cosmetic typo. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavdevice/oss_dec.c')
-rw-r--r--libavdevice/oss_dec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavdevice/oss_dec.c b/libavdevice/oss_dec.c
index d3dbe77cf9..2cdc4324e8 100644
--- a/libavdevice/oss_dec.c
+++ b/libavdevice/oss_dec.c
@@ -91,7 +91,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
bdelay += abufi.bytes;
}
/* subtract time represented by the number of bytes in the audio fifo */
- cur_time -= (bdelay * 1000000LL) / (s->sample_rate * s->channels);
+ cur_time -= (bdelay * 1000000LL) / (s->sample_rate * s->sample_size * s->channels);
/* convert to wanted units */
pkt->pts = cur_time;