Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Unified Diff: services/media/framework/stages/input.h

Issue 1678433002: Motown: Remove LPCM optimizations, fix prepare, add flush, add ActiveMultistreamSink model/stage (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Sync Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/media/framework/stages/distributor_stage.cc ('k') | services/media/framework/stages/input.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/media/framework/stages/input.h
diff --git a/services/media/framework/stages/input.h b/services/media/framework/stages/input.h
new file mode 100644
index 0000000000000000000000000000000000000000..2693a0e8850babbba3ac6a0ae5922125492b0a0c
--- /dev/null
+++ b/services/media/framework/stages/input.h
@@ -0,0 +1,73 @@
+// 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_STAGES_INPUT_H_
+#define SERVICES_MEDIA_FRAMEWORK_STAGES_INPUT_H_
+
+#include "services/media/framework/models/demand.h"
+#include "services/media/framework/packet.h"
+#include "services/media/framework/refs.h"
+
+namespace mojo {
+namespace media {
+
+class Stage;
+class Engine;
+class Output;
+
+// Represents a stage's connector to an adjacent upstream stage.
+class Input {
+ public:
+ Input();
+
+ ~Input();
+
+ // The output to which this input is connected.
+ const OutputRef& mate() const { return mate_; }
+
+ // Establishes a connection.
+ void Connect(const OutputRef& output);
+
+ // Breaks a connection. Called only by the engine.
+ void Disconnect() {
+ DCHECK(!prepared_);
+ mate_ = nullptr;
+ }
+
+ // Determines whether the input is connected to an output.
+ bool connected() const { return static_cast<bool>(mate_); }
+
+ // The connected output.
+ Output& actual_mate() const;
+
+ // Determines if the input is prepared.
+ bool prepared() { return prepared_; }
+
+ // Changes the prepared state of the input.
+ void set_prepared(bool prepared) { prepared_ = prepared; }
+
+ // A packet supplied from upstream.
+ PacketPtr& packet_from_upstream() { return packet_from_upstream_; }
+
+ // Updates mate's demand. Called only by Stage::Update implementations.
+ void SetDemand(Demand demand, Engine* engine) const;
+
+ // Updates packet_from_upstream. Return value indicates whether the stage for
+ // this input should be added to the supply backlog. Called only by
+ // Output instances.
+ bool SupplyPacketFromOutput(PacketPtr packet);
+
+ // Flushes retained media.
+ void Flush();
+
+ private:
+ OutputRef mate_;
+ bool prepared_;
+ PacketPtr packet_from_upstream_;
+};
+
+} // namespace media
+} // namespace mojo
+
+#endif // SERVICES_MEDIA_FRAMEWORK_STAGES_INPUT_H_
« no previous file with comments | « services/media/framework/stages/distributor_stage.cc ('k') | services/media/framework/stages/input.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698