enable eac3 pass-through mode
- For eac3 need using 192K sample rate
- and the sample count for alsa drvier need counted by 2byte per channel/sample
Signed-off-by: Lyon Wang <lyon.wang@nxp.com>
diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c
index 79b4f4a..3e1f8ca 100644
--- a/ext/alsa/gstalsasink.c
+++ b/ext/alsa/gstalsasink.c
@@ -492,6 +492,8 @@
no_channels);
/* set the stream rate */
rrate = alsa->rate;
+ if ((TRUE== alsa->passthrough) && alsa->iec958 && (alsa->type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_EAC3))
+ rrate = 192000;
CHECK (snd_pcm_hw_params_set_rate_near (alsa->handle, params, &rrate, NULL),
no_rate);
@@ -852,6 +854,7 @@
alsa->buffer_time = spec->buffer_time;
alsa->period_time = spec->latency_time;
alsa->access = SND_PCM_ACCESS_RW_INTERLEAVED;
+ alsa->type = spec->type;
if (spec->type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW && alsa->channels < 9)
gst_audio_ring_buffer_set_channel_positions (GST_AUDIO_BASE_SINK
@@ -1062,8 +1065,12 @@
GST_LOG_OBJECT (asink, "received audio samples buffer of %u bytes", length);
- cptr = length / alsa->bpf;
-
+ if (alsa->iec958 && (TRUE == alsa->passthrough) ) {
+ cptr = length / 4; // treated as 2ch with S16 in pass-through mode
+ }
+ else {
+ cptr = length / alsa->bpf;
+ }
GST_ALSA_SINK_LOCK (asink);
while (cptr > 0) {
/* start by doing a blocking wait for free space. Set the timeout
diff --git a/ext/alsa/gstalsasink.h b/ext/alsa/gstalsasink.h
index 64bd1f5..5aab88e 100644
--- a/ext/alsa/gstalsasink.h
+++ b/ext/alsa/gstalsasink.h
@@ -78,6 +78,7 @@
GMutex delay_lock;
gboolean passthrough;
+ GstAudioRingBufferFormatType type;
};
struct _GstAlsaSinkClass {