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

Side by Side Diff: services/media/framework/refs.cc

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: 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/logging.h"
6 #include "services/media/framework/refs.h"
7 #include "services/media/framework/stages/input.h"
8 #include "services/media/framework/stages/output.h"
9 #include "services/media/framework/stages/stage.h"
10
11 namespace mojo {
12 namespace media {
13
14 size_t PartRef::input_count() const {
15 DCHECK(valid());
16 return stage_->input_count();
17 }
18
19 InputRef PartRef::input(size_t index) const {
20 DCHECK(valid());
21 DCHECK(index < stage_->input_count());
22 return InputRef(stage_, index);
23 }
24
25 InputRef PartRef::input() const {
26 DCHECK(valid());
27 DCHECK(stage_->input_count() == 1);
28 return InputRef(stage_, 0);
29 }
30
31 size_t PartRef::output_count() const {
32 DCHECK(valid());
33 return stage_->output_count();
34 }
35
36 OutputRef PartRef::output(size_t index) const {
37 DCHECK(valid());
38 DCHECK(index < stage_->output_count());
39 return OutputRef(stage_, index);
40 }
41
42 OutputRef PartRef::output() const {
43 DCHECK(valid());
44 DCHECK(stage_->output_count() == 1);
45 return OutputRef(stage_, 0);
46 }
47
48 bool InputRef::connected() const {
49 DCHECK(valid());
50 return actual().connected();
51 }
52
53 const OutputRef& InputRef::mate() const {
54 DCHECK(valid());
55 return actual().mate();
56 }
57
58 InputRef::InputRef(Stage* stage, size_t index) :
59 stage_(stage), index_(index) {
60 DCHECK(valid());
61 }
62
63 Input& InputRef::actual() const {
64 DCHECK(valid());
65 return stage_->input(index_);
66 }
67
68 bool InputRef::valid() const {
69 return stage_ != nullptr && index_ < stage_->input_count();
70 }
71
72 bool OutputRef::connected() const {
73 DCHECK(valid());
74 return actual().connected();
75 }
76
77 const InputRef& OutputRef::mate() const {
78 DCHECK(valid());
79 return actual().mate();
80 }
81
82 OutputRef::OutputRef(Stage* stage, size_t index) :
83 stage_(stage), index_(index) {
84 DCHECK(valid());
85 }
86
87 Output& OutputRef::actual() const {
88 DCHECK(valid());
89 return stage_->output(index_);
90 }
91
92 bool OutputRef::valid() const {
93 return stage_ != nullptr && index_ < stage_->output_count();
94 }
95
96 } // namespace media
97 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698