[gst-devel] please help me! Does I block the tee element wrong?

刘兴民 xflxmin17 at 163.com
Fri Aug 6 14:55:32 CEST 2010


Hi,All
Now, I have a problem puzzled me several days. I want to transmit the video and audio to the other computer by 'gstrtpbin'.
The pipeline, I used, as the following.

diagram 1:
                                                   +------+      +--------------------+      +------------+       +-------------+
                                           +----> |queue |--->|ffmpegcolorspace |--->| videoscale |--->|autovideosink|
                                          /        +------+      +---------------------+     +------------+      +-------------+
+----------------+       +---------+ /
|                  |-----> | tee     |       |+---------------------------------------------------------------------------------------------------> will link for transmit video
|                  |       +---------+ \    |      +----------------------------+
|                  |                       \ +---->|                             |
|                  |                                 |                             |
| uridecodebin |                                 |      transmit bin       |
|                 |                                  |                             |
|                 |                        /+----> |                             |
|                 |                      /   |       +----------------------------+
|                 |       +----------+      |+------------------------------------------------------------------------------------------------------>will link for transmit audio
|                 |----->|  tee     |
+--------------+       +----------+
                                     \
                                       \         +------+    +-------------+       +-------------+
                                         +---->|queue |--->|audioconvert |--->|autoaudiosink|
                                                 +------+    +-------------+        +-------------+

diagram 2 (transmit bin):
+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                                                                                                             |
|        +------+     +----------------+         +--------+     +----------+       +-----+               +---------+    +-------+                   |
|        |queue |--->|ffmpegcolorspace|-->|x264enc |-->|rtph264pay|-->|queue|--+           |          | -->|udpsink| rtp for video  | 
|        +------+     +----------------+         +--------+     +----------+      +-----+     \          |          |    +-------+                    |
|--+    /                                                                                             \ +--> |gstrtpbin|    +-------+                    |
|  |   /                                                                                                        |           | --> |udpsink| rtcp for video|
|  |<-+ ghost pad "video_sink"                                             +------+                   |          |      +-------+                   |
|  |                                                              rtcp for video |udpsrc|--------------->  |          |                                    |
|--+                                                                               +------+                   |          |                                    |
|                                                                                                               |          |                                    |
|--+                                                                                +------+                  |          |     +-------+                    |
|  |                                                               rtcp for audio |udpsrc|---------------> |          |--->|udpsink| rtp for audio  |
|  |<-+ ghost pad "audio_sink"                                             +------+                   |          |    +-------+                    |
|  |   \                                                                                             +------>  |          |    +-------+                    |
|--+    \                                                                                        /             |          |--->|udpsink| rtcp for audio |
|        +-----+   +------------+       +----+   +--------------+    +-----+            /                |          |    +-------+                     |
|        |queue|-->|audioconvert|-->|faac|-->|rtpmp4apay |-->|queue|-----------+               +----------+                                   |
|        +-----+   +------------+       +----+   +---------------+   +-----+                                                                             |
|                                                                                                                                                               |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------+


1)I create a pipeline to playback the media for previewing. As diagram 1. But it hasn't contain the transmit bin.
2)I hang the transmit bin to the pipeline which is in the running state.

In order to add the transmit bin dynamicly, I do several steps.
1.add transmit bin to the running pipeline.
2.block video tee element's sink pad, and request a src pad.
3.block audio tee element's sink pad, and request a src pad.
4.link video tee's source pad to transmit bin's "video_sink" ghost pad.
5.link audio tee's source pad to transmit bin's "audio_sink" ghost pad.
6.change the transmit bin's state to running.
7.unblock the double tee's sink pad.  

In order to receive the media in the recevier end, I need the video and audio's caps.So I set up a signal handle to the 'udpsink'.
I can get the video's caps correctly, but I can't get the audio's caps. Note that, the pipeline can playback the video and audio very well.
                                    
I guess the probem may be in the blocking pad section. I change the blocking order, sometimes I can get the audio caps, but the video caps not .

        if( !gst_pad_set_blocked(tee0_pad_sink, TRUE) && !gst_pad_set_blocked(tee1_pad_sink, TRUE) )
        {
            g_printerr("pad block failed");
        }
        if( GST_PAD_LINK_FAILED( gst_pad_link(tee0_pad_src1, transmit_bin_video_sink) ) &&
            GST_PAD_LINK_FAILED( gst_pad_link(tee1_pad_src1, transmit_bin_audio_sink) ) )
        {
            g_printerr("tee1 pad link transmit_bin's video/audio sink failed\n"); 
        }
        gst_element_set_state(transmit_bin, GST_STATE_PLAYING);

        if( !gst_pad_set_blocked(tee0_pad_sink, FALSE) && !gst_pad_set_blocked(tee1_pad_sink, FALSE) )
        {
            g_printerr("pad unblock failed");
        }   


Please help me. Thanks in advance.


More information about the gstreamer-devel mailing list