2012-04-03 112 views
2

我正試圖播放其中一個音頻和另一個頻道中的靜音正在播放的2個頻道。在不同情況下播放多聲道音頻時出錯?

$ gst-launch \ 
    interleave name=i ! alsasink 
    filesrc location=/home/test1.mp3 \ 
     ! decodebin ! audioconvert \ 
     ! audio/x-raw-int,channels=1 ! i. \ 
    audiotestsrc wave=silence \ 
     ! decodebin ! audioconvert \ 
     ! audio/x-raw-int,channels=1 ! volume volume=1.0 ! i. 

10秒後我想在第一聲道播放靜音,在第二聲道播放一些音頻。

$ gst-launch \ 
    interleave name=i ! alsasink \ 
    audiotestsrc wave=silence \ 
     ! decodebin ! audioconvert \ 
     ! audio/x-raw-int,channels=1 ! i. \ 
    filesrc location=/home/test2.mp3 \ 
     ! decodebin ! audioconvert \ 
     ! audio/x-raw-int,channels=1 ! volume volume=1.0 ! i. 

這可以在電腦端完成,而玩這些管道在兩個不同的終端或使其中的一個後臺運行。但是,當我在玩上am335x板上的一個管道,並試圖打另外一個,它是這樣的:

Setting pipeline to PAUSED ... 
ERROR: Pipeline doesn't want to pause. 
ERROR: from element /GstPipeline:pipeline0/GstAlsaSink:alsasink0: Could not open audio device for playback. 
Device is being used by another application. 
Additional debug info: 
gstalsasink.c(697): gst_alsasink_open(): /GstPipeline:pipeline0/GstAlsaSink:alsasink0: 
Device 'default' is busy 
Setting pipeline to NULL ... 
Freeing pipeline ... 

當我們gstalsasink.c檢查,便調用snd_pcm_open在非阻塞模式。

CHECK (snd_pcm_open (&alsa->handle, alsa->device, SND_PCM_STREAM_PLAYBACK, 
     SND_PCM_NONBLOCK), open_error); 

那麼爲什麼它阻止其他活動使用的音頻設備?

任何人都可以建議我爲目標端做什麼,因爲PC端alsasink是完美的。

回答

1

可能會有一些延遲關閉嵌入式硬件上的alsa設備。檢查定影器哪個過程仍然打開。還可以考慮使用gnonlin來開發流的順序播放。這將重用現有的音頻接收器。

+0

gnonlin將不會滿足我的要求,因爲它在實時情況下不確定,在什麼時候應該播放第二個管道。它隨機出現的情況可能是需要用於播放另一個音頻的無聲通道。以及如何在PC端使用相同的管道,同時在目標板上丟擲錯誤。 – Minion 2012-04-04 12:17:15

+0

好吧,所以用例更像是一個無線電流,你想在其中公佈一個配音? – ensonic 2012-04-05 07:46:35

+0

yes.Its喜歡如果只有一個音頻在第一個頻道上播放,我們希望通過第二個聲音開始另一個聲音,這個聲音到現在爲止一直保持沉默,那麼我得到的錯誤是「設備繁忙」。 – Minion 2012-04-08 06:53:49