#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/cast/openscreen/remoting_proto_utils.h"
#include <algorithm>
#include "base/containers/span.h"
#include "base/containers/span_reader.h"
#include "base/containers/span_writer.h"
#include "base/logging.h"
#include "base/time/time.h"
#include "base/types/optional_util.h"
#include "base/values.h"
#include "media/base/encryption_scheme.h"
#include "media/base/timestamp_constants.h"
#include "media/cast/openscreen/remoting_proto_enum_utils.h"
namespace media::cast {
namespace {
constexpr size_t kPayloadVersionFieldSize = …;
constexpr size_t kProtoBufferHeaderSize = …;
constexpr size_t kDataBufferHeaderSize = …;
scoped_refptr<media::DecoderBuffer> ConvertProtoToDecoderBuffer(
const openscreen::cast::DecoderBuffer& buffer_message,
scoped_refptr<media::DecoderBuffer> buffer) { … }
void ConvertDecoderBufferToProto(
const media::DecoderBuffer& decoder_buffer,
openscreen::cast::DecoderBuffer* buffer_message) { … }
}
scoped_refptr<media::DecoderBuffer> ByteArrayToDecoderBuffer(
base::span<const uint8_t> data) { … }
std::vector<uint8_t> DecoderBufferToByteArray(
const media::DecoderBuffer& decoder_buffer) { … }
void ConvertAudioDecoderConfigToProto(
const media::AudioDecoderConfig& audio_config,
openscreen::cast::AudioDecoderConfig* audio_message) { … }
bool ConvertProtoToAudioDecoderConfig(
const openscreen::cast::AudioDecoderConfig& audio_message,
media::AudioDecoderConfig* audio_config) { … }
void ConvertVideoDecoderConfigToProto(
const media::VideoDecoderConfig& video_config,
openscreen::cast::VideoDecoderConfig* video_message) { … }
bool ConvertProtoToVideoDecoderConfig(
const openscreen::cast::VideoDecoderConfig& video_message,
media::VideoDecoderConfig* video_config) { … }
void ConvertProtoToPipelineStatistics(
const openscreen::cast::PipelineStatistics& stats_message,
media::PipelineStatistics* stats) { … }
}