2015-12-12 01:37:01 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2015 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef API_CALL_AUDIO_SINK_H_
|
|
|
|
|
#define API_CALL_AUDIO_SINK_H_
|
2015-12-12 01:37:01 +01:00
|
|
|
|
2022-10-07 21:47:49 +00:00
|
|
|
#include <stddef.h>
|
2022-05-09 09:21:14 +02:00
|
|
|
#include <stdint.h>
|
2015-12-12 01:37:01 +01:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
// Represents a simple push audio sink.
|
2016-01-13 12:00:26 -08:00
|
|
|
class AudioSinkInterface {
|
2015-12-12 01:37:01 +01:00
|
|
|
public:
|
|
|
|
|
virtual ~AudioSinkInterface() {}
|
|
|
|
|
|
|
|
|
|
struct Data {
|
2017-05-11 22:07:37 -07:00
|
|
|
Data(const int16_t* data,
|
2015-12-12 01:37:01 +01:00
|
|
|
size_t samples_per_channel,
|
|
|
|
|
int sample_rate,
|
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-12 16:26:35 -08:00
|
|
|
size_t channels,
|
2015-12-12 01:37:01 +01:00
|
|
|
uint32_t timestamp)
|
|
|
|
|
: data(data),
|
|
|
|
|
samples_per_channel(samples_per_channel),
|
|
|
|
|
sample_rate(sample_rate),
|
|
|
|
|
channels(channels),
|
|
|
|
|
timestamp(timestamp) {}
|
|
|
|
|
|
2017-05-11 22:07:37 -07:00
|
|
|
const int16_t* data; // The actual 16bit audio data.
|
2015-12-12 01:37:01 +01:00
|
|
|
size_t samples_per_channel; // Number of frames in the buffer.
|
|
|
|
|
int sample_rate; // Sample rate in Hz.
|
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-12 16:26:35 -08:00
|
|
|
size_t channels; // Number of channels in the audio data.
|
2015-12-12 01:37:01 +01:00
|
|
|
uint32_t timestamp; // The RTP timestamp of the first sample.
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
virtual void OnData(const Data& audio) = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // API_CALL_AUDIO_SINK_H_
|