Shaka Packager SDK
Loading...
Searching...
No Matches
replicator.cc
1// Copyright 2017 Google LLC. 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#include <cstddef>
10#include <memory>
11#include <utility>
12
13#include <absl/log/check.h>
14
15#include <packager/media/base/media_handler.h>
16#include <packager/status.h>
17
18namespace shaka {
19namespace media {
20
21Status Replicator::InitializeInternal() {
22 return Status::OK;
23}
24
25Status Replicator::Process(std::unique_ptr<StreamData> stream_data) {
26 Status status;
27
28 for (auto& out : output_handlers()) {
29 std::unique_ptr<StreamData> copy(new StreamData(*stream_data));
30 copy->stream_index = out.first;
31
32 status.Update(Dispatch(std::move(copy)));
33 }
34
35 return status;
36}
37
38bool Replicator::ValidateOutputStreamIndex(size_t /* ignored */) const {
39 return true;
40}
41
42Status Replicator::OnFlushRequest(size_t input_stream_index) {
43 DCHECK_EQ(input_stream_index, 0u);
44 return FlushAllDownstreams();
45}
46
47} // namespace media
48} // namespace shaka
Status FlushAllDownstreams()
Flush all connected downstream handlers.
Status Dispatch(std::unique_ptr< StreamData > stream_data) const
All the methods that are virtual are virtual for mocking.