Nagram/TMessagesProj/jni/voip/webrtc/pc/jitter_buffer_delay.h

41 lines
1.2 KiB
C
Raw Normal View History

2020-08-14 16:58:22 +00:00
/*
* Copyright 2019 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef PC_JITTER_BUFFER_DELAY_H_
#define PC_JITTER_BUFFER_DELAY_H_
#include <stdint.h>
#include "absl/types/optional.h"
2021-06-25 00:43:10 +00:00
#include "api/sequence_checker.h"
#include "rtc_base/system/no_unique_address.h"
2020-08-14 16:58:22 +00:00
namespace webrtc {
// JitterBufferDelay converts delay from seconds to milliseconds for the
// underlying media channel. It also handles cases when user sets delay before
2021-06-25 00:43:10 +00:00
// the start of media_channel by caching its request.
class JitterBufferDelay {
2020-08-14 16:58:22 +00:00
public:
2021-06-25 00:43:10 +00:00
JitterBufferDelay();
2020-08-14 16:58:22 +00:00
2021-06-25 00:43:10 +00:00
void Set(absl::optional<double> delay_seconds);
int GetMs() const;
2020-08-14 16:58:22 +00:00
private:
2021-06-25 00:43:10 +00:00
RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_thread_checker_;
absl::optional<double> cached_delay_seconds_
RTC_GUARDED_BY(&worker_thread_checker_);
2020-08-14 16:58:22 +00:00
};
} // namespace webrtc
#endif // PC_JITTER_BUFFER_DELAY_H_