Shaka Packager SDK
replicator.cc
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/replicator/replicator.h"
8 
9 namespace shaka {
10 namespace media {
11 
12 Status Replicator::InitializeInternal() {
13  return Status::OK;
14 }
15 
16 Status Replicator::Process(std::unique_ptr<StreamData> stream_data) {
17  Status status;
18 
19  for (auto& out : output_handlers()) {
20  std::unique_ptr<StreamData> copy(new StreamData(*stream_data));
21  copy->stream_index = out.first;
22 
23  status.Update(Dispatch(std::move(copy)));
24  }
25 
26  return status;
27 }
28 
29 bool Replicator::ValidateOutputStreamIndex(size_t stream_index) const {
30  return true;
31 }
32 
33 Status Replicator::OnFlushRequest(size_t input_stream_index) {
34  DCHECK_EQ(input_stream_index, 0u);
35  return FlushAllDownstreams();
36 }
37 
38 } // namespace media
39 } // namespace shaka
Status Dispatch(std::unique_ptr< StreamData > stream_data) const
All the methods that are virtual are virtual for mocking.
Status FlushAllDownstreams()
Flush all connected downstream handlers.