Skip to content

Commit afb75cb

Browse files
committed
[GStreamer] Avoid preserve pitch with native audio
https://bugs.webkit.org/show_bug.cgi?id=259356 Reviewed by Philippe Normand. Preserve pitch adds a scaletempo element to the pipeline, which prevents decoder-sinks with fancy caps to link as scaletempo only accepts raw caps. * Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::setPlaybackFlags): (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): (WebCore::setPlaybackFlags): Deleted. * Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Canonical link: https://commits.webkit.org/266177@main
1 parent 61315a4 commit afb75cb

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,7 +2875,7 @@ void MediaPlayerPrivateGStreamer::updateDownloadBufferingFlag()
28752875
}
28762876
}
28772877

2878-
static void setPlaybackFlags(GstElement* pipeline, bool isMediaStream)
2878+
void MediaPlayerPrivateGStreamer::setPlaybackFlags(bool isMediaStream)
28792879
{
28802880
unsigned hasAudio = getGstPlayFlag("audio");
28812881
unsigned hasVideo = getGstPlayFlag("video");
@@ -2885,8 +2885,8 @@ static void setPlaybackFlags(GstElement* pipeline, bool isMediaStream)
28852885
unsigned hasSoftwareColorBalance = getGstPlayFlag("soft-colorbalance");
28862886

28872887
unsigned flags = 0;
2888-
g_object_get(pipeline, "flags", &flags, nullptr);
2889-
GST_TRACE_OBJECT(pipeline, "default flags %x", flags);
2888+
g_object_get(pipeline(), "flags", &flags, nullptr);
2889+
GST_TRACE_OBJECT(pipeline(), "default flags %x", flags);
28902890
flags = flags & ~hasText;
28912891
flags = flags & ~hasNativeAudio;
28922892
flags = flags & ~hasNativeVideo;
@@ -2909,12 +2909,17 @@ static void setPlaybackFlags(GstElement* pipeline, bool isMediaStream)
29092909
hasNativeAudio = 0x0;
29102910
#endif
29112911

2912-
GST_INFO_OBJECT(pipeline, "text %s, audio %s (native %s), video %s (native %s, software color balance %s)", boolForPrinting(hasText),
2912+
GST_INFO_OBJECT(pipeline(), "text %s, audio %s (native %s), video %s (native %s, software color balance %s)", boolForPrinting(hasText),
29132913
boolForPrinting(hasAudio), boolForPrinting(hasNativeAudio), boolForPrinting(hasVideo), boolForPrinting(hasNativeVideo),
29142914
boolForPrinting(hasSoftwareColorBalance));
29152915
flags |= hasText | hasAudio | hasVideo | hasNativeVideo | hasNativeAudio | hasSoftwareColorBalance;
2916-
g_object_set(pipeline, "flags", flags, nullptr);
2917-
GST_DEBUG_OBJECT(pipeline, "current pipeline flags %x", flags);
2916+
g_object_set(pipeline(), "flags", flags, nullptr);
2917+
GST_DEBUG_OBJECT(pipeline(), "current pipeline flags %x", flags);
2918+
2919+
if (m_shouldPreservePitch && hasAudio && hasNativeAudio) {
2920+
GST_WARNING_OBJECT(pipeline(), "can't preserve pitch with native audio");
2921+
setPreservesPitch(false);
2922+
}
29182923
}
29192924

29202925
void MediaPlayerPrivateGStreamer::createGSTPlayBin(const URL& url)
@@ -2952,7 +2957,7 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin(const URL& url)
29522957

29532958
GST_INFO_OBJECT(pipeline(), "Using legacy playbin element: %s", boolForPrinting(m_isLegacyPlaybin));
29542959

2955-
setPlaybackFlags(pipeline(), isMediaStream);
2960+
setPlaybackFlags(isMediaStream);
29562961

29572962
// Let also other listeners subscribe to (application) messages in this bus.
29582963
auto bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline.get())));

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface
474474
void commitLoad();
475475
void fillTimerFired();
476476
void didEnd();
477+
void setPlaybackFlags(bool isMediaStream);
477478

478479
GstElement* createVideoSink();
479480
GstElement* createAudioSink();

0 commit comments

Comments
 (0)