virtual double minTimeSeekable() const { return 0; }
virtual std::unique_ptr<PlatformTimeRanges> buffered() const { return PlatformTimeRanges::create(); }
- virtual unsigned totalBytes() const { return 0; }
+ virtual unsigned long long totalBytes() const { return 0; }
virtual bool didLoadingProgress() const { return false; }
virtual void setSize(const IntSize&) { }
virtual MediaTime minMediaTimeSeekable() const { return MediaTime::createWithDouble(minTimeSeekable()); }
virtual std::unique_ptr<PlatformTimeRanges> buffered() const = 0;
+ virtual unsigned long long totalBytes() const { return 0; }
virtual bool didLoadingProgress() const = 0;
virtual void setSize(const IntSize&) = 0;
virtual String languageOfPrimaryAudioTrack() const { return emptyString(); }
- virtual size_t extraMemoryCost() const { return 0; }
-
+ virtual size_t extraMemoryCost() const
+ {
+ MediaTime duration = this->durationMediaTime();
+ if (!duration)
+ return 0;
+
+ unsigned long long extra = totalBytes() * buffered()->totalDuration().toDouble() / duration.toDouble();
+ return static_cast<unsigned>(extra);
+ }
+
virtual unsigned long long fileSize() const { return 0; }
#if ENABLE(MEDIA_SOURCE)
, m_volumeAndMuteInitialized(false)
, m_hasVideo(false)
, m_hasAudio(false)
- , m_totalBytes(-1)
+ , m_totalBytes(0)
, m_preservesPitch(false)
, m_requestedState(GST_STATE_VOID_PENDING)
, m_missingPlugins(false)
return didLoadingProgress;
}
-unsigned MediaPlayerPrivateGStreamer::totalBytes() const
+unsigned long long MediaPlayerPrivateGStreamer::totalBytes() const
{
if (m_errorOccured)
return 0;
- if (m_totalBytes != -1)
+ if (m_totalBytes)
return m_totalBytes;
if (!m_source)
gint64 length = 0;
if (gst_element_query_duration(m_source.get(), fmt, &length)) {
INFO_MEDIA_MESSAGE("totalBytes %" G_GINT64_FORMAT, length);
- m_totalBytes = static_cast<unsigned>(length);
+ m_totalBytes = static_cast<unsigned long long>(length);
m_isStreaming = !length;
return m_totalBytes;
}
gst_iterator_free(iter);
INFO_MEDIA_MESSAGE("totalBytes %" G_GINT64_FORMAT, length);
- m_totalBytes = static_cast<unsigned>(length);
+ m_totalBytes = static_cast<unsigned long long>(length);
m_isStreaming = !length;
return m_totalBytes;
}
std::unique_ptr<PlatformTimeRanges> buffered() const;
float maxTimeSeekable() const;
bool didLoadingProgress() const;
- unsigned totalBytes() const;
+ unsigned long long totalBytes() const;
float maxTimeLoaded() const;
void loadStateChanged();
GThreadSafeMainLoopSource m_videoTimerHandler;
GThreadSafeMainLoopSource m_videoCapsTimerHandler;
GThreadSafeMainLoopSource m_readyTimerHandler;
- mutable long m_totalBytes;
+ mutable unsigned long long m_totalBytes;
URL m_url;
bool m_preservesPitch;
GstState m_requestedState;