webrtc_m130/api/call/audio_sink.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.4 KiB
C
Raw Permalink Normal View History

/*
* 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.
*/
#ifndef API_CALL_AUDIO_SINK_H_
#define API_CALL_AUDIO_SINK_H_
#include <stddef.h>
#include <stdint.h>
namespace webrtc {
// Represents a simple push audio sink.
class AudioSinkInterface {
public:
virtual ~AudioSinkInterface() {}
struct Data {
Reland of Make AudioSinkInterface::Data hold a const pointer to the audio buffer. (patchset #1 id:1 of https://codereview.webrtc.org/2877013002/ ) Reason for revert: Re-land the original CL because the reverting it didn't fix the problem. Original issue's description: > Revert of Make AudioSinkInterface::Data hold a const pointer to the audio buffer. (patchset #1 id:1 of https://codereview.webrtc.org/2873803002/ ) > > Reason for revert: > Reverted because it possibly breaks the internal project. > > Original issue's description: > > Make AudioSinkInterface::Data hold a const pointer to the audio buffer. > > > > This is in preparation for https://codereview.webrtc.org/2750783004/, where > > requiring a non-const pointer for AudioSinkInterface would force an unmuting > > and zeroing of every frame. > > > > BUG=webrtc:7343 > > > > Review-Url: https://codereview.webrtc.org/2873803002 > > Cr-Commit-Position: refs/heads/master@{#18107} > > Committed: https://chromium.googlesource.com/external/webrtc/+/38605965bd68ad1e376c530883041b9c12f26d3b > > TBR=solenberg@webrtc.org,henrik.lundin@webrtc.org,yujo@chromium.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:7343 > > Review-Url: https://codereview.webrtc.org/2877013002 > Cr-Commit-Position: refs/heads/master@{#18112} > Committed: https://chromium.googlesource.com/external/webrtc/+/c904634823fe3021d24116de246c95a7d7a2fb91 TBR=solenberg@webrtc.org,henrik.lundin@webrtc.org,yujo@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:7343 Review-Url: https://codereview.webrtc.org/2880663003 Cr-Commit-Position: refs/heads/master@{#18113}
2017-05-11 22:07:37 -07:00
Data(const int16_t* data,
size_t samples_per_channel,
int sample_rate,
size_t channels,
uint32_t timestamp)
: data(data),
samples_per_channel(samples_per_channel),
sample_rate(sample_rate),
channels(channels),
timestamp(timestamp) {}
Reland of Make AudioSinkInterface::Data hold a const pointer to the audio buffer. (patchset #1 id:1 of https://codereview.webrtc.org/2877013002/ ) Reason for revert: Re-land the original CL because the reverting it didn't fix the problem. Original issue's description: > Revert of Make AudioSinkInterface::Data hold a const pointer to the audio buffer. (patchset #1 id:1 of https://codereview.webrtc.org/2873803002/ ) > > Reason for revert: > Reverted because it possibly breaks the internal project. > > Original issue's description: > > Make AudioSinkInterface::Data hold a const pointer to the audio buffer. > > > > This is in preparation for https://codereview.webrtc.org/2750783004/, where > > requiring a non-const pointer for AudioSinkInterface would force an unmuting > > and zeroing of every frame. > > > > BUG=webrtc:7343 > > > > Review-Url: https://codereview.webrtc.org/2873803002 > > Cr-Commit-Position: refs/heads/master@{#18107} > > Committed: https://chromium.googlesource.com/external/webrtc/+/38605965bd68ad1e376c530883041b9c12f26d3b > > TBR=solenberg@webrtc.org,henrik.lundin@webrtc.org,yujo@chromium.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:7343 > > Review-Url: https://codereview.webrtc.org/2877013002 > Cr-Commit-Position: refs/heads/master@{#18112} > Committed: https://chromium.googlesource.com/external/webrtc/+/c904634823fe3021d24116de246c95a7d7a2fb91 TBR=solenberg@webrtc.org,henrik.lundin@webrtc.org,yujo@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:7343 Review-Url: https://codereview.webrtc.org/2880663003 Cr-Commit-Position: refs/heads/master@{#18113}
2017-05-11 22:07:37 -07:00
const int16_t* data; // The actual 16bit audio data.
size_t samples_per_channel; // Number of frames in the buffer.
int sample_rate; // Sample rate in Hz.
size_t channels; // Number of channels in the audio data.
uint32_t timestamp; // The RTP timestamp of the first sample.
};
virtual void OnData(const Data& audio) = 0;
};
} // namespace webrtc
#endif // API_CALL_AUDIO_SINK_H_