Skip to content
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

[ARRISEOS-44568] Add logs disable alltracks check in gstreamer #285

Open
wants to merge 1 commit into
base: lgi-wpe-2.38
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
20 changes: 16 additions & 4 deletions Source/WebCore/platform/graphics/SourceBufferPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,10 @@ void SourceBufferPrivate::reenqueueMediaIfNeeded(const MediaTime& currentTime)
TrackBuffer& trackBuffer = trackBufferPair.value;
const AtomString& trackID = trackBufferPair.key;

fprintf(stderr, "JJ: before needsReenqueueing, reenqueueMediaIfNeeded, id: %s, needsReenq: %d\n", trackID.string().utf8().data(), trackBuffer.needsReenqueueing());

if (trackBuffer.needsReenqueueing()) {
fprintf(stderr, "JJ: eenqueuing at time: %s\n", trackID.string().utf8().data());
DEBUG_LOG(LOGIDENTIFIER, "reenqueuing at time ", currentTime);
reenqueueMediaForTime(trackBuffer, trackID, currentTime);
} else
Expand Down Expand Up @@ -394,6 +397,9 @@ void SourceBufferPrivate::removeCodedFrames(const MediaTime& start, const MediaT
return;
}

LOG(Media, "JJ: BEFORE SourceBuffer::removeCodedFrames(%p) - buffered = %s", this, toString(m_buffered->ranges()).utf8().data());


// 3.5.9 Coded Frame Removal Algorithm
// https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#sourcebuffer-coded-frame-removal

Expand All @@ -404,16 +410,22 @@ void SourceBufferPrivate::removeCodedFrames(const MediaTime& start, const MediaT
TrackBuffer& trackBuffer = trackBufferKeyValue.value;
AtomString trackID = trackBufferKeyValue.key;

if (!trackBuffer.removeCodedFrames(start, end, currentTime))
LOG(Media, "JJ: before removeCodedFrames, trackID: %s", trackID.string().utf8().data());
if (!trackBuffer.removeCodedFrames(start, end, currentTime, trackID.string()))
continue;

LOG(Media, "JJ: after removeCodedFrames, trackID: %s", trackID.string().utf8().data());

setBufferedDirty(true);

// 3.4 If this object is in activeSourceBuffers, the current playback position is greater than or equal to start
// and less than the remove end timestamp, and HTMLMediaElement.readyState is greater than HAVE_METADATA, then set
// the HTMLMediaElement.readyState attribute to HAVE_METADATA and stall playback.
if (isActive() && currentTime >= start && currentTime < end && readyState() > MediaPlayer::ReadyState::HaveMetadata)
if (isActive() && currentTime >= start && currentTime < end && readyState() > MediaPlayer::ReadyState::HaveMetadata) {
LOG(Media, "JJ: should stall playback! (%p), trackID: %s - buffered = %s", this, trackID.string().utf8().data(), toString(m_buffered->ranges()).utf8().data());

setReadyState(MediaPlayer::ReadyState::HaveMetadata);

}
}

reenqueueMediaIfNeeded(currentTime);
Expand All @@ -425,7 +437,7 @@ void SourceBufferPrivate::removeCodedFrames(const MediaTime& start, const MediaT

updateHighestPresentationTimestamp();

LOG(Media, "SourceBuffer::removeCodedFrames(%p) - buffered = %s", this, toString(m_buffered->ranges()).utf8().data());
LOG(Media, "JJ: SourceBuffer::removeCodedFrames(%p) - buffered = %s", this, toString(m_buffered->ranges()).utf8().data());

m_client->sourceBufferPrivateReportExtraMemoryCost(totalTrackBufferSizeInBytes());

Expand Down
7 changes: 6 additions & 1 deletion Source/WebCore/platform/graphics/TrackBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ static WARN_UNUSED_RETURN bool decodeTimeComparator(const PresentationOrderSampl
return a.second->decodeTime() < b.second->decodeTime();
};

bool TrackBuffer::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime)
bool TrackBuffer::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, const WTF::String trackID)
{
// 3.5.9 Coded Frame Removal Algorithm
// https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#sourcebuffer-coded-frame-removal
Expand Down Expand Up @@ -309,9 +309,14 @@ bool TrackBuffer::removeCodedFrames(const MediaTime& start, const MediaTime& end
PlatformTimeRanges possiblyEnqueuedRanges(currentTime, m_highestEnqueuedPresentationTime);
possiblyEnqueuedRanges.intersectWith(erasedRanges);
if (possiblyEnqueuedRanges.length()) {
LOG(Media, "JJ: m_needsReenqueueing == true; currentTime: %f, m_highestEnqueuedPresentationTime: %f, trackID: %s", currentTime.toFloat() , m_highestEnqueuedPresentationTime.toFloat(), trackID.utf8().data());
m_needsReenqueueing = true;
DEBUG_LOG_IF(m_logger, LOGIDENTIFIER, "the range in removeCodedFrames() includes already enqueued samples, reenqueueing from ", currentTime);
} else {
LOG(Media, "JJ: m_needsReenqueueing == false; currentTime: %f, m_highestEnqueuedPresentationTime: %f, trackID: %s", currentTime.toFloat() , m_highestEnqueuedPresentationTime.toFloat(), trackID.utf8().data());
}
} else {
LOG(Media, "JJ: not _highestEnqueuedPresentationTime.isValid() && currentTime < m_highestEnqueuedPresentationTime, curentTime: %f, m_highestEnqueuedPresentationTime: %f, m_highestEnqueuedPresentationTime.isValid(): %d, trackID: %s", currentTime.toFloat(), m_highestEnqueuedPresentationTime.toFloat(), m_highestEnqueuedPresentationTime.isValid(), trackID.utf8().data());
}

erasedRanges.invert();
Expand Down
3 changes: 2 additions & 1 deletion Source/WebCore/platform/graphics/TrackBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <wtf/LoggerHelper.h>
#include <wtf/MediaTime.h>
#include <wtf/UniqueRef.h>
#include <wtf/text/WTFString.h>

namespace WebCore {

Expand All @@ -56,7 +57,7 @@ class TrackBuffer final

bool reenqueueMediaForTime(const MediaTime&, const MediaTime& timeFudgeFactor);
MediaTime findSeekTimeForTargetTime(const MediaTime& targetTime, const MediaTime& negativeThreshold, const MediaTime& positiveThreshold);
bool removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime);
bool removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, const WTF::String trackID);
PlatformTimeRanges removeSamples(const DecodeOrderSampleMap::MapType&, const char*);

void resetTimestampOffset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ void SourceBufferPrivateGStreamer::flush(const AtomString& trackId)

// This is only for on-the-fly reenqueues after appends. When seeking, the seek will do its own flush.

if (!m_playerPrivate.hasAllTracks()) {
GST_DEBUG_OBJECT(m_playerPrivate.pipeline(), "Source element has not emitted tracks yet, so we only need to clear the queue. trackId = '%s'", trackId.string().utf8().data());
MediaSourceTrackGStreamer* track = m_tracks.get(trackId);
track->clearQueue();
return;
}
// if (!m_playerPrivate.hasAllTracks()) {
// GST_DEBUG_OBJECT(m_playerPrivate.pipeline(), "Source element has not emitted tracks yet, so we only need to clear the queue. trackId = '%s'", trackId.string().utf8().data());
// MediaSourceTrackGStreamer* track = m_tracks.get(trackId);
// track->clearQueue();
// return;
// }

GST_DEBUG_OBJECT(m_playerPrivate.pipeline(), "Source element has emitted tracks, let it handle the flush, which may cause a pipeline flush as well. trackId = '%s'", trackId.string().utf8().data());
webKitMediaSrcFlush(m_playerPrivate.webKitMediaSrc(), trackId);
Expand Down