简体   繁体   中英

Use multiple processes in Android gstreamer!!‏

I'm reading the Android tutorial to gstreamer . I'd like to make a simple pipeline from one android phone to another, like this . 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.

I'd like to make two processes to make the android phone send and receive audio!

On Linux I would use fork() , like this:

p = fork();
if p==0{
    //pipeline1
}
else {
   //pipeline2
}

But this doesn't work on Android, I get this error:

{
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.

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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM