2015-07-24 15:28:16 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2019-10-02 13:23:02 +03:00
|
|
|
#ifndef MOZILLA_AUDIOCAPTURETRACK_H_
|
|
|
|
#define MOZILLA_AUDIOCAPTURETRACK_H_
|
2015-07-24 15:28:16 +03:00
|
|
|
|
2019-10-02 13:23:02 +03:00
|
|
|
#include "MediaTrackGraph.h"
|
2015-07-24 15:28:16 +03:00
|
|
|
#include "AudioMixer.h"
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2016-12-08 11:00:12 +03:00
|
|
|
class AbstractThread;
|
2015-07-24 15:28:16 +03:00
|
|
|
class DOMMediaStream;
|
|
|
|
|
|
|
|
/**
|
2019-10-02 13:23:02 +03:00
|
|
|
* See MediaTrackGraph::CreateAudioCaptureTrack.
|
2015-07-24 15:28:16 +03:00
|
|
|
*/
|
2019-10-02 13:23:02 +03:00
|
|
|
class AudioCaptureTrack : public ProcessedMediaTrack,
|
|
|
|
public MixerCallbackReceiver {
|
2015-07-24 15:28:16 +03:00
|
|
|
public:
|
2019-10-02 13:23:02 +03:00
|
|
|
explicit AudioCaptureTrack(TrackRate aRate);
|
|
|
|
virtual ~AudioCaptureTrack();
|
2015-07-24 15:28:16 +03:00
|
|
|
|
2016-03-03 19:26:31 +03:00
|
|
|
void Start();
|
|
|
|
|
2015-07-24 15:28:16 +03:00
|
|
|
void ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags) override;
|
|
|
|
|
2020-11-05 19:41:45 +03:00
|
|
|
uint32_t NumberOfChannels() const override;
|
|
|
|
|
2015-07-24 15:28:16 +03:00
|
|
|
protected:
|
|
|
|
void MixerCallback(AudioDataValue* aMixedBuffer, AudioSampleFormat aFormat,
|
|
|
|
uint32_t aChannels, uint32_t aFrames,
|
|
|
|
uint32_t aSampleRate) override;
|
|
|
|
AudioMixer mMixer;
|
2016-03-03 19:26:31 +03:00
|
|
|
bool mStarted;
|
2015-07-24 15:28:16 +03:00
|
|
|
bool mTrackCreated;
|
|
|
|
};
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2019-10-02 13:23:02 +03:00
|
|
|
#endif /* MOZILLA_AUDIOCAPTURETRACK_H_ */
|