Skip to content

[MSE][GStreamer] don't push samples while seeking #1528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: wpe-2.46
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ bool MediaPlayerPrivateGStreamerMSE::doSeek(const SeekTarget& target, float rate
// This will also add support for fastSeek once done (see webkit.org/b/260607)
if (!m_mediaSourcePrivate)
return false;
m_mediaSourcePrivate->willSeek();
m_mediaSourcePrivate->waitForTarget(target)->whenSettled(RunLoop::current(), [this, weakThis = ThreadSafeWeakPtr { *this }](auto&& result) {
RefPtr self = weakThis.get();
if (!self || !result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ TrackID MediaSourcePrivateGStreamer::registerTrackId(TrackID preferredId)
return assignedId;
}

void MediaSourcePrivateGStreamer::willSeek()
{
for (auto* sourceBuffer : m_activeSourceBuffers)
downcast<SourceBufferPrivateGStreamer>(sourceBuffer)->willSeek();
}

bool MediaSourcePrivateGStreamer::unregisterTrackId(TrackID trackId)
{
ASSERT(isMainThread());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ class MediaSourcePrivateGStreamer final : public MediaSourcePrivate
TrackID registerTrackId(TrackID);
bool unregisterTrackId(TrackID);

void willSeek();

#if !RELEASE_LOG_DISABLED
const Logger& logger() const final { return m_logger; }
ASCIILiteral logClassName() const override { return "MediaSourcePrivateGStreamer"_s; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,23 @@ size_t SourceBufferPrivateGStreamer::platformEvictionThreshold() const
return evictionThreshold;
}

void SourceBufferPrivateGStreamer::willSeek()
{
ALWAYS_LOG(LOGIDENTIFIER);
m_seeking = true;
}

bool SourceBufferPrivateGStreamer::isSeeking() const
{
return m_seeking;
}

void SourceBufferPrivateGStreamer::seekToTime(const MediaTime& time)
{
m_seeking = false;
SourceBufferPrivate::seekToTime(time);
}

#undef GST_CAT_DEFAULT

} // namespace WebCore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ class SourceBufferPrivateGStreamer final : public SourceBufferPrivate, public Ca
size_t platformMaximumBufferSize() const override;
size_t platformEvictionThreshold() const final;

void willSeek();
bool isSeeking() const final;
void seekToTime(const MediaTime&) final;

private:
friend class AppendPipeline;

Expand All @@ -109,6 +113,7 @@ class SourceBufferPrivateGStreamer final : public SourceBufferPrivate, public Ca
std::unique_ptr<AppendPipeline> m_appendPipeline;
StdUnorderedMap<TrackID, RefPtr<MediaSourceTrackGStreamer>> m_tracks;
std::optional<MediaPromise::Producer> m_appendPromise;
bool m_seeking { false };

#if !RELEASE_LOG_DISABLED
Ref<const Logger> m_logger;
Expand Down