#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/cast_streaming/browser/frame/stream_consumer.h"
#include <algorithm>
#include "base/containers/span.h"
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "components/cast_streaming/browser/common/decoder_buffer_factory.h"
#include "components/cast_streaming/common/public/features.h"
#include "media/base/media_util.h"
#include "media/mojo/common/media_type_converters.h"
#include "third_party/openscreen/src/platform/base/span.h"
namespace cast_streaming {
StreamConsumer::BufferDataWrapper::~BufferDataWrapper() = default;
base::span<uint8_t> StreamConsumer::BufferDataWrapper::Get() { … }
base::span<uint8_t> StreamConsumer::BufferDataWrapper::Consume(
uint32_t max_size) { … }
bool StreamConsumer::BufferDataWrapper::Reset(uint32_t new_size) { … }
void StreamConsumer::BufferDataWrapper::Clear() { … }
uint32_t StreamConsumer::BufferDataWrapper::Size() const { … }
StreamConsumer::StreamConsumer(
openscreen::cast::Receiver* receiver,
mojo::ScopedDataPipeProducerHandle data_pipe,
FrameReceivedCB frame_received_cb,
base::RepeatingClosure on_new_frame,
std::unique_ptr<DecoderBufferFactory> decoder_buffer_factory)
: … { … }
StreamConsumer::~StreamConsumer() = default;
void StreamConsumer::ReadFrame(base::OnceClosure no_frames_available_cb) { … }
void StreamConsumer::CloseDataPipeOnError() { … }
void StreamConsumer::OnPipeWritable(MojoResult result) { … }
void StreamConsumer::OnFramesReady(int next_frame_buffer_size) { … }
void StreamConsumer::FlushUntil(uint32_t frame_id) { … }
void StreamConsumer::MaybeSendNextFrame() { … }
}