| Index: services/media/framework/stages/lpcm_stage_input.h
|
| diff --git a/services/media/framework/stages/lpcm_stage_input.h b/services/media/framework/stages/lpcm_stage_input.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ef085c16857aaa9ccf918afe0da22234d0d30bef
|
| --- /dev/null
|
| +++ b/services/media/framework/stages/lpcm_stage_input.h
|
| @@ -0,0 +1,94 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef SERVICES_MEDIA_FRAMEWORK_ENGINE_LPCM_STAGE_INPUT_H_
|
| +#define SERVICES_MEDIA_FRAMEWORK_ENGINE_LPCM_STAGE_INPUT_H_
|
| +
|
| +#include "services/media/framework/lpcm_util.h"
|
| +#include "services/media/framework/models/demand.h"
|
| +#include "services/media/framework/models/lpcm_frames.h"
|
| +#include "services/media/framework/stages/stage_input.h"
|
| +
|
| +namespace mojo {
|
| +namespace media {
|
| +
|
| +class LpcmStageOutput;
|
| +
|
| +// Represents a stage's connector to an adjacent upstream stage, with LPCM
|
| +// optmizations.
|
| +class LpcmStageInput : public StageInput {
|
| + public:
|
| + LpcmStageInput();
|
| +
|
| + ~LpcmStageInput();
|
| +
|
| + // Sets the stream type.
|
| + void set_stream_type(const LpcmStreamType& stream_type);
|
| +
|
| + // Suggests possible demand frame count, useful when !connected_to_lpcm().
|
| + void suggest_demand(uint64_t frame_count, Engine& engine);
|
| +
|
| + // Updates mate's demand.
|
| + void set_lpcm_demand(
|
| + void* buffer,
|
| + uint64_t frame_count,
|
| + bool mix,
|
| + bool synchronous,
|
| + Engine& engine);
|
| +
|
| + // Returns supplied frames.
|
| + LpcmFrames& lpcm_supply() {
|
| + return lpcm_supply_;
|
| + }
|
| +
|
| + // Indicates whether we've hit end-of-stream.
|
| + bool end_of_stream() {
|
| + return end_of_stream_;
|
| + }
|
| +
|
| + // Indicates the frame count originally demanded.
|
| + uint64_t demand_frame_count() {
|
| + return frame_count_;
|
| + }
|
| +
|
| + // StageInput overrides.
|
| + bool supply_packet_internal(PacketPtr packet) override;
|
| +
|
| + LpcmStageInput* get_lpcm() override;
|
| +
|
| + private:
|
| + static const uint64_t kDefaultFrameCount = 512;
|
| +
|
| + bool connected_to_lpcm();
|
| +
|
| + // Copies or mixes frames from packet_frames_ to demand_frames_. This is only
|
| + // used when !connected_to_lpcm() and the stage has supplied a buffer. The
|
| + // return value indicates whether the demand was met.
|
| + bool CopyOrMixFrames();
|
| +
|
| + // Ensures demand_buffer_ can accommodate frame_count frames and returns it.
|
| + void* GetDemandBuffer(uint64_t frame_count);
|
| +
|
| + bool demand_pending_;
|
| +
|
| + void* buffer_;
|
| + uint64_t frame_count_;
|
| + bool mix_;
|
| + bool synchronous_;
|
| +
|
| + LpcmFrames lpcm_supply_; // Frames supplied to this stage.
|
| + LpcmFrames packet_frames_; // Source for packet payload copy/mix.
|
| + LpcmFrames demand_frames_; // Destination for packet payload copy/mix.
|
| +
|
| + bool end_of_stream_;
|
| +
|
| + std::unique_ptr<LpcmUtil> lpcm_util_;
|
| + void* demand_buffer_;
|
| + uint64_t demand_buffer_frame_count_;
|
| +};
|
| +
|
| +} // namespace media
|
| +} // namespace mojo
|
| +
|
| +#endif // SERVICES_MEDIA_FRAMEWORK_ENGINE_LPCM_STAGE_INPUT_H_
|
|
|