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

Unified Diff: services/media/framework/stages/stage_input.cc

Issue 1577953002: Motown in-proc streaming framework used to implement media services. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: sync Created 4 years, 11 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/stage_input.h ('k') | services/media/framework/stages/stage_output.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/media/framework/stages/stage_input.cc
diff --git a/services/media/framework/stages/stage_input.cc b/services/media/framework/stages/stage_input.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0f5312adfd79558974f7f54d0d88f02a0f19163c
--- /dev/null
+++ b/services/media/framework/stages/stage_input.cc
@@ -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.
+
+#include "services/media/framework/engine.h"
+#include "services/media/framework/stages/stage.h"
+#include "services/media/framework/stages/stage_input.h"
+
+namespace mojo {
+namespace media {
+
+StageInput::StageInput() :
+ upstream_stage_(nullptr),
+ output_index_(0),
+ allocator_(nullptr),
+ must_allocate_(false) {}
+
+StageInput::~StageInput() {}
+
+void StageInput::connect(Stage* upstream_stage, uint32_t output_index) {
+ DCHECK(upstream_stage);
+ DCHECK(output_index < upstream_stage->output_count());
+ DCHECK(upstream_stage_ == nullptr);
+ upstream_stage_ = upstream_stage;
+ output_index_ = output_index;
+}
+
+StageOutput& StageInput::mate() const {
+ DCHECK(upstream_stage_);
+ DCHECK(output_index_ < upstream_stage_->output_count());
+ return upstream_stage_->output(output_index_);
+}
+
+void StageInput::Prepare(Allocator* allocator, bool must_allocate) {
+ DCHECK(allocator != nullptr || must_allocate == false);
+ allocator_ = allocator;
+ must_allocate_ = must_allocate;
+}
+
+Allocator* StageInput::allocator() const {
+ DCHECK(connected());
+ DCHECK(mate().downstream_stage()->prepared());
+ return allocator_;
+}
+
+bool StageInput::must_allocate() const {
+ DCHECK(connected());
+ DCHECK(mate().downstream_stage()->prepared());
+ return must_allocate_;
+}
+
+void StageInput::SetDemand(Demand demand, Engine* engine) const {
+ DCHECK(engine);
+ DCHECK(connected());
+
+ if (mate().UpdateDemand(demand)) {
+ engine->PushToDemandBacklogUnsafe(upstream_stage());
+ }
+}
+
+bool StageInput::SupplyPacketFromOutput(PacketPtr packet) {
+ DCHECK(packet);
+ DCHECK(!packet_from_upstream_);
+ packet_from_upstream_ = std::move(packet);
+ return true;
+}
+
+LpcmStageInput* StageInput::get_lpcm() {
+ return nullptr;
+}
+
+} // namespace media
+} // namespace mojo
« no previous file with comments | « services/media/framework/stages/stage_input.h ('k') | services/media/framework/stages/stage_output.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698