[英]Use multiple processes in Android gstreamer!!
I'm reading the Android tutorial to gstreamer
. 我正在阅读gstreamer
的Android教程。 I'd like to make a simple pipeline from one android phone to another, like this . 我想作一个简单的管道从一个android手机到另一个, 像这样 。 I've read these questions: loading same gstreamer elements multiple times in a process , and JNI - multi threads , but they didn't help me resolve my current issue. 我已经阅读了以下问题: 在一个进程中多次加载相同的gstreamer元素 ,以及JNI-多线程 ,但是它们并没有帮助我解决当前的问题。
I'd like to make two processes to make the android phone send and receive audio! 我想进行两个过程来使android手机发送和接收音频!
On Linux I would use fork()
, like this: 在Linux上,我将使用fork()
,如下所示:
p = fork();
if p==0{
//pipeline1
}
else {
//pipeline2
}
But this doesn't work on Android, I get this error: 但这在Android上不起作用,出现此错误:
{
g_source_set_callback: assertion `source != NULL' failed
Fatal signal 11 (SIGSEGV) at 0x00000010 (code=1)
}
How can I resolve this? 我该如何解决?
With GStreamer you can run 2 pipelines in the same process without having to worry about threading as it's already handled internally. 使用GStreamer,您可以在同一进程中运行2个管道,而不必担心线程已在内部进行处理。
void
start (GError **error) {
GstElement *pipe1;
GstElement *pipe2;
*error = NULL;
pipe1 = gst_parse_launch ("src ! enc ! mux ! sink", error);
if (*error != NULL)
return;
pipe2 = gst_parse_launch ("src ! demux ! dec ! sink", error);
if (*error != NULL)
return;
gst_element_set_state (pipe1, GST_STATE_PLAYING);
gst_element_set_state (pipe2, GST_STATE_PLAYING);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.