alumae / kaldi-gstreamer-server

Real-time full-duplex speech recognition server, based on the Kaldi toolkit and the GStreamer framwork.
BSD 2-Clause "Simplified" License
1.07k stars 342 forks source link

Changing cap for decoder2.py #183

Open Szu-JuiChen opened 5 years ago

Szu-JuiChen commented 5 years ago

First of all, I added cutter into decoder2.py, where I followed how the decoder.py use the cutter. And if I change sample rate in caps_str, for example, from 44.1k to 16k, there will be ERROR shown below:

""" 0:01:56.895377839 2566 0x7fefc80038a0 DEBUG kaldinnet2onlinedecoder gstkaldinnet2onlinedecoder.cc:1639:gst_kaldinnet2onlinedecoder_query: Setting caps query result: audio/x-raw, format=(string)S16LE, rate=(int)8000, channels=(int)1 0:01:56.895468977 2566 0x7fefc80038a0 DEBUG kaldinnet2onlinedecoder gstkaldinnet2onlinedecoder.cc:1663:gst_kaldinnet2onlinedecoder_sink_event: Handling caps event 0:01:56.965513159 2566 0x7fefc8003990 WARN GST_PADS gstpad.c:4224:gst_pad_peer_query: could not send sticky events 0:01:57.035066975 2566 0x7fefc8003990 WARN basesrc gstbasesrc.c:3055:gst_base_src_loop: error: Internal data stream error. 0:01:57.035140551 2566 0x7fefc8003990 WARN basesrc gstbasesrc.c:3055:gst_base_src_loop: error: streaming stopped, reason not-negotiated (-4) 0:01:57.035307306 2566 0x7fefc80038a0 DEBUG kaldinnet2onlinedecoder gstkaldinnet2onlinedecoder.cc:1663:gst_kaldinnet2onlinedecoder_sink_event: Handling stream-group-done event 0:01:57.035412743 2566 0x7fefc80038a0 DEBUG kaldinnet2onlinedecoder gstkaldinnet2onlinedecoder.cc:1663:gst_kaldinnet2onlinedecoder_sink_event: Handling eos event 0:01:57.035473892 2566 0x7fefc80038a0 DEBUG kaldinnet2onlinedecoder gstkaldinnet2onlinedecoder.cc:1683:gst_kaldinnet2onlinedecoder_sink_event: EOS received 0:01:57.035545346 2566 0x7fefc80038a0 DEBUG kaldinnet2onlinedecoder gstkaldinnet2onlinedecoder.cc:1687:gst_kaldinnet2onlinedecoder_sink_event: EOS received while not decoding, pushing EOS out 2019-04-10 19:58:09 - ERROR: decoder2: (gerror=GLib.Error('Internal data stream error.', 'gst-stream-error-quark', 1), debug='gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstAppSrc:appsrc:\nstreaming stopped, reason not-negotiated (-4)') """

I have found the reason is due to mismatch between sink and src between elements. Looks like the init_request function can't initialize the pipeline correctly.

Right now I can only kill the worker and restart again to avoid this issue. Does anyone know how to fix it or how to kill the pipeline and rebuild again?