rtspsrc Internal dataflow error

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

rtspsrc Internal dataflow error

pneves
Hello,

I am having a bit of a problem using rtspsrc to open an rtsp stream from rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov

First I would like to point that the documentation is not clear, and that if there is any way I can contribute to it I would be happy to do it. It says that the stream should be accessible through the stream_%u ghost pad. The problem is that it doesn't say that we should wait for "pad-added" events.

I also did not find it clear that it only established a connection when it was in GST_STATE_PLAYING. I know it's a live source and only produces data in playing but all the connection configuration could happen in other states. Forgive me if I overlooked some convention. To finish the ghost pad stream_%u is never added and I don't really know why.

On the other hand, the pad-added signal or no-more-pads signal say a pad recv_rtp_src_1_179414008_97 is added, to which I successfully link the sink of rtph264depay.

The caps of recv_rtp_src_1_179414008_97:
0:00:01.184836234 12464       0x9aa5e0 DEBUG                rtspsrc gstrtspsrc.c:4372:gst_rtspsrc_configure_caps:<rtspsrc0> stream 0x7f73bc02ab40, pt 97, caps application/x-rtp, media=(string)video, payload=(int)97, clock-rate=(int)90000, encoding-name=(string)H264, packetization-mode=(string)1, profile-level-id=(string)42C01E, sprop-parameter-sets=(string)"Z0LAHtkDxWhAAAADAEAAAAwDxYuS\,aMuMsg\=\=", a-framesize=(string)240-160, a-sdplang=(string)en, a-cliprect=(string)"0\,0\,160\,240", a-framerate=(string)24.0, ssrc=(uint)179414008, clock-base=(uint)18720, seqnum-base=(uint)6, npt-start=(guint64)208000000, npt-stop=(guint64)596480000000, play-speed=(double)1, play-scale=(double)

Unfortunately I end up with a data flow error in like:

:8069:gst_rtspsrc_handle_message:<rtspsrc0> got error from udpsrc0
0:00:01.236465927 12509 0x7f980005db20 DEBUG                rtspsrc gstrtspsrc.c:8083:gst_rtspsrc_handle_message:<rtspsrc0> combined flows: not-linked
0:00:01.236479744 12509 0x7f980005dc00 DEBUG                rtspsrc gstrtspsrc.c:8069:gst_rtspsrc_handle_message:<rtspsrc0> got error from udpsrc2
0:00:01.236501261 12509 0x7f980005dc00 DEBUG                rtspsrc gstrtspsrc.c:8083:gst_rtspsrc_handle_message:<rtspsrc0> combined flows: not-linked

I am very positive it is linked because if I link to an incompatible element it gives me a linking error. The pipeline is:
rtspsrc->rtph264deapy->h264parse->avdec_h264->queue->autovideosink

GstElement* Gstreamer::createElement(const char *element_type) {
        GstElement* new_element = gst_element_factory_make(element_type, NULL);
        AP_LOG("%s\n", element_type);
        if (new_element == nullptr) {
                throw GstreamerException(GstreamerException::NULL_ELEMENT);
        }
        return new_element;
}

GstElement* Gstreamer::pushElementToPipeline(const char* element_type,
        bool link_to_pipeline) {
        GstElement * new_element = createElement(element_type);
        addToBin(new_element);
        if (!element_vector.empty() && link_to_pipeline == true) {
                linkElements(element_vector.back(), new_element);

        }
        element_vector.push_back(new_element);
        return new_element;
}

void Gstreamer::connectRTSPNoMorePadsSignal(GstElement *element,
        RTSPSrcSignalData * const data) {
        data->instance.notifyConditionVariable();
}

void Gstreamer::setupRTSPSource(const std::string location, int latency,
        VideoType type) {

        GstElement * source = pushElementToPipeline("rtspsrc", true);
        g_object_set(source, "location", location.c_str(), NULL);
        g_object_set(source, "latency", latency, NULL);
        RTSPSrcSignalData signal_data = {nullptr, nullptr, *this};
        g_signal_connect(source, "no-more-pads",
                G_CALLBACK(Gstreamer::connectRTSPNoMorePadsSignal), &signal_data);
        setStateOnElement(source, GST_STATE_PLAYING);
        std::unique_lock<std::mutex> lock(instance_mutex);

        while(!condition_variable_predicate){
                condition_variable.wait(lock);
        }
        condition_variable_predicate = false;
        AP_LOG("RTSPsrc unblocked\n");
        GstElement *depay = pushElementToPipeline("rtph264depay", false);
        GstPad* depay_pad = gst_element_get_static_pad(depay, "sink");
        GstCaps *source_caps = gst_caps_new_simple("application/x-rtp", "media",
                G_TYPE_STRING, "video", NULL);
        GstPad* source_pad = gst_element_get_compatible_pad(source, depay_pad,
                source_caps);
        gchar * source_pad_name = gst_pad_get_name(source_pad);
        AP_LOG("Pad name %s\n", source_pad_name);
        if (source_pad != NULL) {
                gst_caps_unref(source_caps);
                GstPadLinkReturn r = gst_pad_link(source_pad, depay_pad);
                if (r != GST_PAD_LINK_OK)
                        throw std::runtime_error("sdsad");
                AP_LOG("Pad linkes %s, %d\n", source_pad_name, r);
        }
        else {
                throw std::runtime_error("sdsad");
        }
        g_free(source_pad_name);
}

I have battled with this combined flows not linked for some time. What am I doing wrong?

Best regards
Paulo Neves