summaryrefslogtreecommitdiffstats
path: root/sys/oss
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2005-09-27 15:12:45 +0000
committerTim-Philipp Müller <tim@centricular.net>2005-09-27 15:12:45 +0000
commit26745bb1327e92c3838ba018a5399331db004817 (patch)
tree0ed59ba17c46cebc0f444ec42166a06096c4bba8 /sys/oss
parentc84ad80a51cc7cc0783ae113d04def8466de367c (diff)
sys/oss/gstosssink.c: Fix playback of mono streams (bytes_per_sample should be set from the sample width and the numb...
Original commit message from CVS: * sys/oss/gstosssink.c: (gst_oss_sink_prepare): Fix playback of mono streams (bytes_per_sample should be set from the sample width and the number of channels negotiated, and not just be set to 4) (#317338)
Diffstat (limited to 'sys/oss')
-rw-r--r--sys/oss/gstosssink.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/oss/gstosssink.c b/sys/oss/gstosssink.c
index a98efab1..92dd0ecd 100644
--- a/sys/oss/gstosssink.c
+++ b/sys/oss/gstosssink.c
@@ -325,8 +325,12 @@ gst_oss_sink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
spec->segsize = info.fragsize;
spec->segtotal = info.fragstotal;
- spec->bytes_per_sample = 4;
- oss->bytes_per_sample = 4;
+
+ if (spec->width != 16 && spec->width != 8)
+ goto dodgy_width;
+
+ spec->bytes_per_sample = (spec->width / 8) * spec->channels;
+ oss->bytes_per_sample = (spec->width / 8) * spec->channels;
memset (spec->silence_sample, 0, spec->bytes_per_sample);
GST_DEBUG ("got segsize: %d, segtotal: %d, value: %08x", spec->segsize,
@@ -339,6 +343,11 @@ wrong_format:
GST_DEBUG ("wrong format %d\n", spec->format);
return FALSE;
}
+dodgy_width:
+ {
+ GST_DEBUG ("unexpected width %d\n", spec->width);
+ return FALSE;
+ }
}
static gboolean