SkyWay Linux SDK
読み取り中…
検索中…
一致する文字列を見つけられません
pcm_audio_source.hpp
1#ifndef SKYWAY_MEDIA_AUDIO_PCM_AUDIO_SOURCE_HPP_
2#define SKYWAY_MEDIA_AUDIO_PCM_AUDIO_SOURCE_HPP_
3
4#include <mutex>
5#include <vector>
6#include "absl/types/optional.h"
7
8#include "api/audio_options.h"
9#include "api/media_stream_interface.h"
10#include "rtc_base/ref_counted_object.h"
11
12#include "skyway/media/audio/interface/pcm_audio_source.hpp"
13
14namespace skyway {
15namespace media {
16namespace audio {
17
19public:
27 static std::shared_ptr<PcmAudioSource> Create(
29
32 rtc::scoped_refptr<webrtc::AudioSourceInterface> GetSource() override;
34
35 bool PushPcmData(const int16_t* buffer) override;
36
37private:
38 class PcmInternalAudioSource : public webrtc::AudioSourceInterface {
39 public:
40 PcmInternalAudioSource(const interface::PcmAudioSource::Options& options);
41 ~PcmInternalAudioSource() override = default;
42
43 // webrtc::MediaSourceInterface
44 webrtc::MediaSourceInterface::SourceState state() const override;
45 bool remote() const override { return false; };
46 void RegisterObserver(webrtc::ObserverInterface* observer) override;
47 void UnregisterObserver(webrtc::ObserverInterface* observer) override;
48
49 // webrtc::AudioSourceInterface
50 void AddSink(webrtc::AudioTrackSinkInterface* sink) override;
51 void RemoveSink(webrtc::AudioTrackSinkInterface* sink) override;
52
53 const cricket::AudioOptions options() const override { return cricket::AudioOptions{}; }
54
55 bool PushPcmData(const int16_t* buffer);
56
57 private:
58 mutable std::mutex observer_mtx_;
59 mutable std::mutex sinks_mtx_;
60 std::vector<webrtc::ObserverInterface*> ms_observers_;
61 std::vector<webrtc::AudioTrackSinkInterface*> sinks_;
62 int sample_rate_;
63 int channels_;
64 };
65
66 rtc::scoped_refptr<PcmInternalAudioSource> internal_source_;
67};
68
69} // namespace audio
70} // namespace media
71} // namespace skyway
72
73#endif // SKYWAY_MEDIA_AUDIO_PCM_AUDIO_SOURCE_HPP_
Definition pcm_audio_source.hpp:18
static std::shared_ptr< PcmAudioSource > Create(const interface::PcmAudioSource::Options &options)
PCM音声ソースのインスタンスを作成します。
bool PushPcmData(const int16_t *buffer) override
PCM音声データを送信します。
PCM音声ソース
Definition pcm_audio_source.hpp:14
PCM音声ソースのオプション
Definition pcm_audio_source.hpp:24