0

I would like to play a ts file, which has one or two videos.

I created a pipeline, and dynamically linked the elements with demux, whenever a pad arises in callback of demux function.

As shown below.

if(g_str_has_prefix(pad_name, "video"))
    {
        UU_PRINT("Player :: In dynamic ADDING DL PAD %s DLLinkFlag %d, LinkFlag %d", pad_name, pObjPlayer->mDlLinkFlag, linkFlag);

           if(!linkFlag)
            {
            GstPad *dlsink = gst_element_get_static_pad(pObjPlayer->mpDlQueue, "sink");
             }
             else
               {
            GstPad *dlsink = gst_element_get_static_pad(pObjPlayer->mpIrQueue, "sink");
               }
            if(GST_IS_PAD(DeMuxPad) && GST_IS_PAD(dlsink))
            {
                if(gst_pad_link(DeMuxPad, dlsink) != GST_PAD_LINK_OK)
                {
                    UU_PRINT( "Player :: Failed to Link Demux with DL Video Queue !!");
                }
                else
                {
                  linkFlag = 1;
                }
           }

Initially, i added two videosinks to Pipeline BIN, if the ts file has two videos then it is working fine.

But if the ts file has only one video, then in ximagesink window gets paused. In order to play that ts file, i have to remove another sink element, which is not receiving data should be removed from bin.

And in that case i am not able to receive the END OF THE STREAM MESSAGE.

Why is is happening? Is there any other way to play those two ts files, by using same pipeline, without removing the sink element.??

1 Answers1

1

All the sinks in a pipeline must receive data in order for the pipeline to preroll and then move to the playing state. If one sink isn't receiving data all the others will wait for it to receive.

Details on prerolling: https://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-preroll.txt

Basically if one sink would just start rendering before other receive data it would mean that the data that reaches the 'late' sink would already be discarded because it would be too late to play it in sync with the data on the first sink (it has already been played).

In short, you should only add sinks to the pipeline if you intend to use them.

thiagoss
  • 2,034
  • 13
  • 8