| 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 PC_JITTER_BUFFER_DELAY_H_ |
| 12 | #define PC_JITTER_BUFFER_DELAY_H_ |
| 13 |
| 14 | #include <stdint.h> |
| 15 |
| 16 | #include "absl/types/optional.h" |
| 17 | #include "api/sequence_checker.h" |
| 18 | #include "rtc_base/system/no_unique_address.h" |
| 19 | #include "rtc_base/thread_annotations.h" |
| 20 |
| 21 | namespace webrtc { |
| 22 |
| 23 | // JitterBufferDelay converts delay from seconds to milliseconds for the |
| 24 | // underlying media channel. It also handles cases when user sets delay before |
| 25 | // the start of media_channel by caching its request. |
| 26 | class JitterBufferDelay { |
| 27 | public: |
| 28 | JitterBufferDelay() = default; |
| 29 |
| 30 | void Set(absl::optional<double> delay_seconds); |
| 31 | int GetMs() const; |
| 32 |
| 33 | private: |
| 34 | RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_thread_checker_{ |
| 35 | SequenceChecker::kDetached}; |
| 36 | absl::optional<double> cached_delay_seconds_ |
| 37 | RTC_GUARDED_BY(&worker_thread_checker_); |
| 38 | }; |
| 39 |
| 40 | } // namespace webrtc |
| 41 |
| 42 | #endif // PC_JITTER_BUFFER_DELAY_H_ |
| 43 |