summaryrefslogtreecommitdiff
path: root/Audio/TxAudioQueueEpochSnapshot.hpp
blob: 21b6d0526a4c8ae9b10a55523b632db65918a70c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef TX_AUDIO_QUEUE_EPOCH_SNAPSHOT_HPP_
#define TX_AUDIO_QUEUE_EPOCH_SNAPSHOT_HPP_

#include "TxAudioQueue.hpp"

namespace TxAudioQueueDetail
{
  inline bool tryMakeEpochSnapshot (quint64 sequence_before,
                                    qint64 epoch,
                                    quint64 sequence_after,
                                    TxAudioQueueEpoch& result) noexcept
  {
    if ((sequence_before & 1) || sequence_before != sequence_after)
      {
        return false;
      }

    result = TxAudioQueueEpoch {epoch};
    return true;
  }
}

#endif