summaryrefslogtreecommitdiffstats
path: root/dom/media/webm/NesteggPacketHolder.h
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/webm/NesteggPacketHolder.h')
-rw-r--r--dom/media/webm/NesteggPacketHolder.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/dom/media/webm/NesteggPacketHolder.h b/dom/media/webm/NesteggPacketHolder.h
index 7c74f752d3..e1e7822106 100644
--- a/dom/media/webm/NesteggPacketHolder.h
+++ b/dom/media/webm/NesteggPacketHolder.h
@@ -25,11 +25,12 @@ class NesteggPacketHolder {
mOffset(-1),
mTimestamp(-1),
mDuration(-1),
+ mDefaultDuration(-1),
mTrack(0),
mIsKeyframe(false) {}
- bool Init(nestegg_packet* aPacket, int64_t aOffset, unsigned aTrack,
- bool aIsKeyframe) {
+ bool Init(nestegg_packet* aPacket, nestegg* aContext, int64_t aOffset,
+ unsigned aTrack, bool aIsKeyframe) {
uint64_t timestamp_ns;
if (nestegg_packet_tstamp(aPacket, &timestamp_ns) == -1) {
return false;
@@ -47,6 +48,10 @@ class NesteggPacketHolder {
if (!nestegg_packet_duration(aPacket, &duration_ns)) {
mDuration = duration_ns / 1000;
}
+ if (!nestegg_track_default_duration(aContext, mTrack, &duration_ns)) {
+ mDefaultDuration = duration_ns / 1000;
+ }
+
return true;
}
@@ -66,6 +71,10 @@ class NesteggPacketHolder {
MOZ_ASSERT(IsInitialized());
return mDuration;
}
+ int64_t DefaultDuration() const {
+ MOZ_ASSERT(IsInitialized());
+ return mDefaultDuration;
+ }
unsigned Track() {
MOZ_ASSERT(IsInitialized());
return mTrack;
@@ -78,7 +87,7 @@ class NesteggPacketHolder {
private:
~NesteggPacketHolder() { nestegg_free_packet(mPacket); }
- bool IsInitialized() { return mOffset >= 0; }
+ bool IsInitialized() const { return mOffset >= 0; }
nestegg_packet* mPacket;
@@ -90,8 +99,13 @@ class NesteggPacketHolder {
int64_t mTimestamp;
// Packet duration in microseconds; -1 if unknown or retrieval failed.
+ // https://www.webmproject.org/docs/container/#BlockDuration
int64_t mDuration;
+ // Default durtaion in microseconds; -1 if unknown or retrieval failed.
+ // https://www.webmproject.org/docs/container/#Duration
+ int64_t mDefaultDuration;
+
// Track ID.
unsigned mTrack;