1 /* 2 * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef VIDEO_TASK_QUEUE_FRAME_DECODE_SCHEDULER_H_ 12 #define VIDEO_TASK_QUEUE_FRAME_DECODE_SCHEDULER_H_ 13 14 #include "video/frame_decode_scheduler.h" 15 16 namespace webrtc { 17 18 // An implementation of FrameDecodeScheduler that is based on TaskQueues. This 19 // is the default implementation for general use. 20 class TaskQueueFrameDecodeScheduler : public FrameDecodeScheduler { 21 public: 22 TaskQueueFrameDecodeScheduler(Clock* clock, 23 TaskQueueBase* const bookkeeping_queue); 24 ~TaskQueueFrameDecodeScheduler() override; 25 TaskQueueFrameDecodeScheduler(const TaskQueueFrameDecodeScheduler&) = delete; 26 TaskQueueFrameDecodeScheduler& operator=( 27 const TaskQueueFrameDecodeScheduler&) = delete; 28 29 // FrameDecodeScheduler implementation. 30 absl::optional<uint32_t> ScheduledRtpTimestamp() override; 31 void ScheduleFrame(uint32_t rtp, 32 FrameDecodeTiming::FrameSchedule schedule, 33 FrameReleaseCallback cb) override; 34 void CancelOutstanding() override; 35 void Stop() override; 36 37 private: 38 Clock* const clock_; 39 TaskQueueBase* const bookkeeping_queue_; 40 41 absl::optional<uint32_t> scheduled_rtp_; 42 ScopedTaskSafetyDetached task_safety_; 43 bool stopped_ = false; 44 }; 45 46 } // namespace webrtc 47 48 #endif // VIDEO_TASK_QUEUE_FRAME_DECODE_SCHEDULER_H_ 49