Shaka Packager SDK
Loading...
Searching...
No Matches
Public Member Functions | List of all members
shaka::media::PtsUnwrapper Class Reference

#include <timestamp_util.h>

Public Member Functions

int64_t Unwrap (int64_t wrapped_pts)
 
void Reset ()
 Resets the unwrapper state (for stream discontinuities).
 
bool IsInitialized () const
 

Detailed Description

Unwraps 33-bit PTS/DTS timestamps to produce monotonically increasing 64-bit timestamps, handling wrap-around transitions.

This class maintains state across multiple timestamp observations and detects when a wrap-around occurs, automatically adjusting the output to maintain monotonicity.

Example usage: PtsUnwrapper unwrapper; unwrapper.Unwrap(8589934500); // Returns 8589934500 (first call) unwrapper.Unwrap(100); // Returns 8589934692 (detected wrap) unwrapper.Unwrap(200); // Returns 8589934792 (continues)

Thread-safety: NOT thread-safe. Each stream should have its own instance.

Definition at line 70 of file timestamp_util.h.

Member Function Documentation

◆ IsInitialized()

bool shaka::media::PtsUnwrapper::IsInitialized ( ) const
inline

Returns true if the unwrapper has been initialized with at least one timestamp.

Definition at line 85 of file timestamp_util.h.

◆ Reset()

void shaka::media::PtsUnwrapper::Reset ( )

Resets the unwrapper state (for stream discontinuities).

Definition at line 88 of file timestamp_util.cc.

◆ Unwrap()

int64_t shaka::media::PtsUnwrapper::Unwrap ( int64_t  wrapped_pts)

Unwraps a wrapped timestamp to a monotonically increasing value.

Parameters
wrapped_pts33-bit PTS/DTS value (may wrap around)
Returns
Unwrapped 64-bit timestamp (monotonically increasing)

Definition at line 36 of file timestamp_util.cc.


The documentation for this class was generated from the following files: