AW: Video artifacts on a receiver side after re-creating of its pipeline

Thornton, Keith keith.thornton at zeiss.com
Wed Jan 10 14:14:46 UTC 2018


Hi, the consumer needs an SPS and PPS. This could be transmitted by setting the config-interval parameter of rtph264pay.

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org] Im Auftrag von Denis Shienkov
Gesendet: Mittwoch, 10. Januar 2018 14:23
An: Discussion of the development of and with GStreamer <gstreamer-devel at lists.freedesktop.org>
Cc: Tim Müller <tim at centricular.com>
Betreff: Video artifacts on a receiver side after re-creating of its pipeline

Hi all.

I use two own applications: producer & consumer.

A producer generates the video stream and sends to the UDP sink.
A consumer receives this stream and displays a video content.

When the consumer started before the producer, then I did not get any video artifacts on an consumer.

But, when I try to do stop/start the consumer (when the producer already running), then I see many video artifacts on the consumer.

A possible workaround it is try to restart the producer (in this case the consumer receives good video content).

How to solve this issue?

UPD:

A producer uses the following pipeline's equivalent:

[code]
void Producer::start()
{
     ...
     ...

     m_appsrc = ::gst_element_factory_make("appsrc", nullptr);

     ::g_object_set(G_OBJECT(m_appsrc),
                    "stream-type", GST_APP_STREAM_TYPE_STREAM,
                    "is-live", true,
                    "format", GST_FORMAT_TIME,
                    nullptr);

     const auto videoconvert =
::gst_element_factory_make("videoconvert", nullptr);

     const auto videoenc = ::gst_element_factory_make("x264enc", nullptr);

     ::gst_util_set_object_arg(G_OBJECT(videoenc), "tune", "zerolatency");

     ::g_object_set(G_OBJECT(videoenc),
                    "key-int-max", 10,
                    nullptr);

     const auto parse = ::gst_element_factory_make("h264parse", nullptr);

     ::g_object_set(G_OBJECT(parse),
                    "config-interval", -1,
                    nullptr);

     const auto payloader = ::gst_element_factory_make("rtph264pay",
nullptr);

     const auto udpsink = ::gst_element_factory_make("udpsink", nullptr);

     const auto host = destination.host().toLocal8Bit();
     const auto port = destination.port();

     ::g_object_set(G_OBJECT(udpsink),
                    "host", host.constData(),
                    "port", port,
                    nullptr);

     m_pipeline = ::gst_pipeline_new("pipeline");

     ...
     ...

     if (!m_appsrc || !videoconvert || !videoenc
             || !payloader || !udpsink) {
         qCCritical(gstProducerControl) << "Unable to create one of pipeline element";
     }

     ::gst_bin_add_many(GST_BIN(m_pipeline),
                        m_appsrc,
                        videoconvert,
                        videoenc,
                        parse,
                        payloader,
                        udpsink,
                        nullptr);

     const auto result = ::gst_element_link_many(m_appsrc,
                                                 videoconvert,
                                                 videoenc,
                                                 parse,
                                                 payloader,
                                                 udpsink,
                                                 nullptr);
     ...
     const auto status = ::gst_element_set_state(m_pipeline,
GST_STATE_PLAYING);
     ...
}

void Foo::stop()
{
     ...
     ::gst_element_set_state(m_pipeline, GST_STATE_NULL);
     ::gst_object_unref(m_pipeline);

     m_appsrc = nullptr;
     m_pipeline = nullptr;
     ...
}
[/code]

A consumer uses the following pipeline's equivalent:

[code]
void Consumer::start()
{
     ...
     const auto udpsrc = ::gst_element_factory_make("udpsrc", nullptr);

     ::g_object_set(G_OBJECT(udpsrc),
                    "address", address.constData(),
                    "port", port,
                    nullptr);

     const auto srccaps = ::gst_caps_new_simple(
                 "application/x-rtp",
                 "", G_TYPE_STRING, "",
                 nullptr);

     ::g_object_set(G_OBJECT(udpsrc),
                    "caps", srccaps,
                    nullptr);

     const auto depay = ::gst_element_factory_make("rtph264depay", nullptr);
     const auto decodebin = ::gst_element_factory_make("decodebin",
nullptr);
     const auto videoconvert =
::gst_element_factory_make("videoconvert", nullptr);

     const auto videofilter = ::gst_element_factory_make("capsfilter",
nullptr);

     const auto videofiltercaps = ::gst_caps_new_simple(
                 "video/x-raw",
                 "format", G_TYPE_STRING, "BGRA",
                 nullptr);

     ::g_object_set(G_OBJECT(videofilter),
                    "caps", videofiltercaps,
                    nullptr);

     m_videosink = m_renderer->videoSink();

     ::g_object_set(G_OBJECT(m_videosink),
                    "sync", false,
                    nullptr);

     m_pipeline = ::gst_pipeline_new("pipeline");

     ...

     ::gst_bin_add_many(GST_BIN(m_pipeline),
                        udpsrc,
                        depay,
                        decodebin,
                        videoconvert,
                        videofilter,
                        m_videosink,
                        nullptr);

     ::gst_element_link_many(udpsrc, depay, decodebin, nullptr);
     ::gst_element_link_many(videoconvert, videofilter, m_videosink, nullptr);

     ...

     const auto status = ::gst_element_set_state(m_pipeline,
GST_STATE_PLAYING);
     ...
}

void Consumer::stop()
{
     ::gst_element_set_state(m_pipeline, GST_STATE_NULL);
     ::gst_object_unref(m_pipeline);

     m_videosink = nullptr;
     m_pipeline = nullptr;
}
[/code]

BR,
Denis
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


More information about the gstreamer-devel mailing list