Skip to content

Commit

Permalink
[MSE][GStreamer] Update m_presentationSize and improve logging
Browse files Browse the repository at this point in the history
Now the proper presentationSize is logged (before, old values were used, so
quality changes were difficult to detect). Also, now logging is more homogeneous
between appends and enqueues, so both are comparable.

Fixed a problem: when a sample was both [SYNC] and [NON-DISPLAYING], none of
the tags were logged.
  • Loading branch information
eocanha committed Jul 10, 2020
1 parent cab04ce commit e2b0349
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
14 changes: 12 additions & 2 deletions Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp
Expand Up @@ -759,14 +759,24 @@ void AppendPipeline::appsinkNewSample(GRefPtr<GstSample>&& sample)
return;
}

if (!m_presentationSize.isEmpty()) {
GstCaps* caps = gst_sample_get_caps(sample.get());
std::optional<FloatSize> size = getVideoResolutionFromCaps(caps);
if (size.has_value() && size.value() != m_presentationSize)
m_presentationSize = size.value();
}

RefPtr<MediaSampleGStreamer> mediaSample = WebCore::MediaSampleGStreamer::create(WTFMove(sample), m_presentationSize, trackId());

GST_TRACE("append: trackId=%s PTS=%s DTS=%s DUR=%s presentationSize=%.0fx%.0f",
GST_TRACE("append: MediaSample %p trackId=%s PTS=%s DTS=%s DUR=%s presentationSize=%.0fx%.0f %s%s",
dynamic_cast<MediaSample*>(mediaSample.get()),
mediaSample->trackID().string().utf8().data(),
mediaSample->presentationTime().toString().utf8().data(),
mediaSample->decodeTime().toString().utf8().data(),
mediaSample->duration().toString().utf8().data(),
mediaSample->presentationSize().width(), mediaSample->presentationSize().height());
mediaSample->presentationSize().width(), mediaSample->presentationSize().height(),
mediaSample->isSync() ? "[SYNC]" : "",
mediaSample->isNonDisplaying() ? "[NON-DISPLAYING]" : "");

// If we're beyond the duration, ignore this sample and the remaining ones.
MediaTime duration = m_mediaSourceClient->duration();
Expand Down
Expand Up @@ -351,11 +351,15 @@ void PlaybackPipeline::enqueueSample(Ref<MediaSample>&& mediaSample)

AtomicString trackId = mediaSample->trackID();

GST_TRACE("enqueing sample trackId=%s PTS=%s presentationSize=%.0fx%.0f at %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT,
trackId.string().utf8().data(), mediaSample->presentationTime().toString().utf8().data(),
GST_TRACE("enqueing MediaSample %p trackId=%s PTS=%s DTS=%s DUR=%s presentationSize=%.0fx%.0f %s%s",
&(mediaSample.get()),
mediaSample->trackID().string().utf8().data(),
mediaSample->presentationTime().toString().utf8().data(),
mediaSample->decodeTime().toString().utf8().data(),
mediaSample->duration().toString().utf8().data(),
mediaSample->presentationSize().width(), mediaSample->presentationSize().height(),
GST_TIME_ARGS(WebCore::toGstClockTime(mediaSample->presentationTime())),
GST_TIME_ARGS(WebCore::toGstClockTime(mediaSample->duration())));
mediaSample->isSync() ? "[SYNC]" : "",
mediaSample->isNonDisplaying() ? "[NON-DISPLAYING]" : "");

// No need to lock to access the Stream here because the only chance of conflict with this read and with the usage
// of the sample fields done in this method would be the deletion of the stream. However, that operation can only
Expand Down

0 comments on commit e2b0349

Please sign in to comment.