• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef AUDIO_PRIMARY_SOURCE_CLOCK_H
17 #define AUDIO_PRIMARY_SOURCE_CLOCK_H
18 
19 #include "audio_source_clock.h"
20 
21 namespace OHOS {
22 namespace AudioStandard {
23 
24 class AudioCapturerSourceClock : public AudioSourceClock {
25 public:
~AudioCapturerSourceClock()26     ~AudioCapturerSourceClock() override {}
27     uint64_t GetTimestamp(uint32_t positionInc) final;
28     void CheckAndResetTimestamp(uint64_t &timestamp, uint32_t positionInc);
29 
30     uint32_t GetFrameCnt() const;
31     void Reset();
32     void SetFirstTimestampFromHdi(uint64_t hdiTimestamp);
33 private:
34     uint32_t frameCnt_ = 0;
35     uint64_t firstTimeStamp_ = 0;
36     uint64_t lastTs_ = 0;
37     bool isGetTimeStampFromSystemClock_ = false;
38 };
39 
40 } // namespace AudioStandard
41 } // namespace OHOS
42 
43 #endif // AUDIO_PRIMARY_SOURCE_CLOCK_H
44