diff options
author | Matt Jacobson <mhjacobson@me.com> | 2022-06-01 05:06:16 -0400 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2022-06-19 23:01:20 +0200 |
commit | b3e261bab381f43ab5f842725d30479d511d1111 (patch) | |
tree | 9701150e05f1c2a7c6147023d04bc8aab8d40c8f /libavdevice/oss.c | |
parent | fee765c2078ba03e346e311c86a447a116fe8c5f (diff) | |
download | ffmpeg-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.c')
-rw-r--r-- | libavdevice/oss.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavdevice/oss.c b/libavdevice/oss.c index eddc2ddf1a..b042f58875 100644 --- a/libavdevice/oss.c +++ b/libavdevice/oss.c @@ -102,9 +102,11 @@ int ff_oss_audio_open(AVFormatContext *s1, int is_output, switch(tmp) { case AFMT_S16_LE: s->codec_id = AV_CODEC_ID_PCM_S16LE; + s->sample_size = 2; break; case AFMT_S16_BE: s->codec_id = AV_CODEC_ID_PCM_S16BE; + s->sample_size = 2; break; default: av_log(s1, AV_LOG_ERROR, "Soundcard does not support 16 bit sample format\n"); @@ -112,7 +114,7 @@ int ff_oss_audio_open(AVFormatContext *s1, int is_output, return AVERROR(EIO); } err=ioctl(audio_fd, SNDCTL_DSP_SETFMT, &tmp); - CHECK_IOCTL_ERROR(SNDCTL_DSP_SETFMTS) + CHECK_IOCTL_ERROR(SNDCTL_DSP_SETFMT) tmp = (s->channels == 2); err = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp); |