chromium/third_party/openscreen/src/cast/streaming/public/frame_id.h

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CAST_STREAMING_PUBLIC_FRAME_ID_H_
#define CAST_STREAMING_PUBLIC_FRAME_ID_H_

#include <stdint.h>

#include <limits>
#include <sstream>
#include <string>

#include "cast/streaming/impl/expanded_value_base.h"

namespace openscreen::cast {

// Forward declaration (see below).
class FrameId;

// Convenience operator overloads for logging.
std::ostream& operator<<(std::ostream& out, const FrameId rhs);

// Unique identifier for a frame in a RTP media stream.  FrameIds are truncated
// to 8-bit values in RTP and RTCP headers, and then expanded back by the other
// endpoint when parsing the headers.
//
// Usage example:
//
//   // Distance/offset math.
//   FrameId first = FrameId::first();
//   FrameId second = first + 1;
//   FrameId third = second + 1;
//   int64_t offset = third - first;
//   FrameId fourth = second + offset;
//
//   // Logging convenience.
//   OSP_DLOG_INFO << "The current frame is " << fourth;
class FrameId : public ExpandedValueBase<int64_t, FrameId> {};

}  // namespace openscreen::cast

#endif  // CAST_STREAMING_PUBLIC_FRAME_ID_H_