// Copyright 2019 The MediaPipe Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef MEDIAPIPE_FRAMEWORK_INPUT_STREAM_SHARD_H_ #define MEDIAPIPE_FRAMEWORK_INPUT_STREAM_SHARD_H_ #include <queue> #include <string> #include "mediapipe/framework/input_stream.h" #include "mediapipe/framework/packet.h" namespace mediapipe { // For testing class MediaPipeProfilerTestPeer; // InputStreamShard, a subclass of InputStream, holds a header packet, a FIFO // queue of input packets, and a bool variable to indicate if the stream is // completely done. Each call to Calculator::Open(), Calculator::Process(), and // Calculator::Close() can only access its own InputStreamShard(s). // // The input stream handler makes sure exactly one packet is added to each shard // per Calculator::Process call. This is done by pushing empty packets when // necessary to guarantee alignment with the corresponding timestamps. Every // call to ClearCurrentPacket() must remove a packet from the queue and every // call to Value() must successfully return the front element of the queue. class InputStreamShard : public InputStream { … }; } // namespace mediapipe #endif // MEDIAPIPE_FRAMEWORK_INPUT_STREAM_SHARD_H_