Skip to content

Commit 6dc7dda

Browse files
emutavchieocanha
authored andcommitted
[GStreamer][WebRTC] increase size of apps max-bytes for video tracks
https://bugs.webkit.org/show_bug.cgi?id=305576 Reviewed by Xabier Rodriguez-Calvar. The default value for max-bytes in 200000 is not enough and leads to frame drops during pipeline buildup. See: #1595 This patch increases the buffering size of the appsrc element used for video tracks in GStreamerMediaStreamSource so that it can handle enough buffering to allow for the rest of the pipeline to be built before buffers start to be lost. The right types are used for the parameters, according to GObject best practices[1]. Aa an opportunistic cleanup task, types for max-buffer/max-bytes arguments in GStreamerVideoDecoderFactory are also enforced as guint64. This seems to be the recommended way to do it according to the GObject documentation[1], [1] https://docs.gtk.org/gobject/method.Object.set.html#description Original author: Eugene Mutavchi <Ievgen_Mutavchi@comcast.com> * Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: Increase buffering size for video tracks and use proper types for the parameters. * Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoDecoderFactory.cpp: Cleanup by properly typing guint64 parameters. Canonical link: https://commits.webkit.org/305705@main
1 parent 0a2922e commit 6dc7dda

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ class InternalSource final : public MediaStreamTrackPrivateObserver,
166166

167167
g_object_set(m_src.get(), "is-live", TRUE, "format", GST_FORMAT_TIME, "emit-signals", TRUE, "min-percent", 100,
168168
"do-timestamp", isCaptureTrack, "handle-segment-change", TRUE, nullptr);
169+
if (track.isVideo())
170+
g_object_set(m_src.get(), "max-bytes", static_cast<guint64>(2 * MB), nullptr);
169171
g_signal_connect(m_src.get(), "enough-data", G_CALLBACK(+[](GstElement*, InternalSource* data) {
170172
data->m_enoughData = true;
171173
}), this);

Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoDecoderFactory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class GStreamerWebRTCVideoDecoder : public webrtc::VideoDecoder {
8686
bool Configure(const webrtc::VideoDecoder::Settings& codecSettings) override
8787
{
8888
m_src = makeElement("appsrc");
89-
g_object_set(m_src, "is-live", TRUE, "do-timestamp", TRUE, "max-buffers", 2, "max-bytes", 0, nullptr);
89+
g_object_set(m_src, "is-live", TRUE, "do-timestamp", TRUE, "max-buffers", static_cast<gint64>(2), "max-bytes", static_cast<guint64>(0), nullptr);
9090

9191
GRefPtr<GstCaps> caps = nullptr;
9292
auto capsfilter = CreateFilter();

0 commit comments

Comments
 (0)