Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/media/framework/graph.h" | 5 #include "services/media/framework/graph.h" |
| 6 | 6 |
| 7 namespace mojo { | 7 namespace mojo { |
| 8 namespace media { | 8 namespace media { |
| 9 | 9 |
| 10 Graph::Graph() { | 10 Graph::Graph() { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 DCHECK(input.valid()); | 192 DCHECK(input.valid()); |
| 193 engine_.PrepareInput(input); | 193 engine_.PrepareInput(input); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void Graph::PrimeSinks() { | 196 void Graph::PrimeSinks() { |
| 197 for (Stage* sink : sinks_) { | 197 for (Stage* sink : sinks_) { |
| 198 sink->Prime(); | 198 sink->Prime(); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 void Graph::FlushOutput(const OutputRef& output) { | |
| 203 DCHECK(output); | |
| 204 engine_.FlushOutput(output); | |
| 205 } | |
| 206 | |
| 207 void Graph::FlushAllOutputs(PartRef part) { | |
| 208 DCHECK(part.valid()); | |
| 209 size_t output_count = part.output_count(); | |
| 210 for (size_t output_index = 0; output_index < output_count; output_index++) { | |
| 211 const OutputRef& output = part.output(output_index); | |
| 212 if (output.connected()) { | |
|
johngro
2016/02/23 00:49:42
if the output.connected() check is important, perh
dalesat
2016/02/23 20:34:34
Done.
| |
| 213 FlushOutput(output); | |
| 214 } | |
| 215 } | |
| 216 } | |
| 217 | |
| 202 PartRef Graph::Add(Stage* stage) { | 218 PartRef Graph::Add(Stage* stage) { |
| 203 stages_.push_back(stage); | 219 stages_.push_back(stage); |
| 204 | 220 |
| 205 if (stage->input_count() == 0) { | 221 if (stage->input_count() == 0) { |
| 206 sources_.push_back(stage); | 222 sources_.push_back(stage); |
| 207 } | 223 } |
| 208 | 224 |
| 209 if (stage->output_count() == 0) { | 225 if (stage->output_count() == 0) { |
| 210 sinks_.push_back(stage); | 226 sinks_.push_back(stage); |
| 211 } | 227 } |
| 212 | 228 |
| 213 stage->SetUpdateCallback(update_function_); | 229 stage->SetUpdateCallback(update_function_); |
| 214 | 230 |
| 215 return PartRef(stage); | 231 return PartRef(stage); |
| 216 } | 232 } |
| 217 | 233 |
| 218 } // namespace media | 234 } // namespace media |
| 219 } // namespace mojo | 235 } // namespace mojo |
| OLD | NEW |