Chromium Code Reviews| 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..0df92d9db6be7bebff7298088298442f0c93c075 |
| --- /dev/null |
| +++ b/services/media/framework/stages/lpcm_stage_input.h |
| @@ -0,0 +1,101 @@ |
| +// 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 SuggestDemand(uint64_t frame_count, Engine* engine); |
| + |
| + // Updates mate's demand. |
|
jeffbrown
2016/02/02 05:35:48
I have no idea what this is really doing. Strange
dalesat
2016/02/02 21:46:40
There's only one engine for a given graph. My thin
|
| + void SetLpcmDemand( |
| + void* buffer, |
| + uint64_t frame_count, |
| + bool mix, |
| + bool synchronous, |
| + Engine* engine); |
| + |
| + // Indicates whether demand is pending. |
| + bool demand_pending() const { |
| + return demand_pending_; |
| + } |
| + |
| + // Returns supplied frames. |
| + LpcmFrames& lpcm_supply() { |
| + return lpcm_supply_; |
| + } |
| + |
| + // Indicates whether we've hit end-of-stream. |
| + bool end_of_stream() const { |
| + return end_of_stream_; |
| + } |
| + |
| + // Indicates the frame count originally demanded. |
| + uint64_t demand_frame_count() const { |
| + return frame_count_; |
| + } |
| + |
| + // StageInput overrides. |
| + bool SupplyPacketFromOutput(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_; |
| + |
| + LpcmFrames::ExhaustedCallback packet_exhausted_function_; |
| +}; |
| + |
| +} // namespace media |
| +} // namespace mojo |
| + |
| +#endif // SERVICES_MEDIA_FRAMEWORK_ENGINE_LPCM_STAGE_INPUT_H_ |