Commit 57093b46 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #28334: audiocodec: remove unused dest offset argument

parent 2e354ffc
......@@ -56,11 +56,13 @@ AudioCodec::AudioCodec(const AudioCodec& c) :
hasDynamicPayload_(c.hasDynamicPayload_)
{}
int AudioCodec::decode(std::vector<std::vector<SFLAudioSample> > &dst, unsigned char *buf, size_t buffer_size, size_t dst_offset /* = 0 */)
// Mono only, subclasses must implement multichannel support
int AudioCodec::decode(std::vector<std::vector<SFLAudioSample> > &dst, unsigned char *buf, size_t buffer_size)
{
return decode(&(*(dst[0].begin() + dst_offset)), buf, buffer_size);
return decode(dst[0].data(), buf, buffer_size);
}
// Mono only, subclasses must implement multichannel support
int AudioCodec::encode(unsigned char *dst, std::vector<std::vector<SFLAudioSample> > &src, size_t buffer_size)
{
return encode(dst, src[0].data(), buffer_size);
......
......@@ -81,7 +81,7 @@ class AudioCodec {
* Multichannel version of decode().
* Default implementation decode(short *, unsigned char *, size_t) to the first channel (assume 1 channel).
*/
virtual int decode(std::vector<std::vector<SFLAudioSample> > &dst, unsigned char *buf, size_t buffer_size, size_t dst_offset=0);
virtual int decode(std::vector<std::vector<SFLAudioSample> > &dst, unsigned char *buf, size_t buffer_size);
/**
* Multichannel version of encode().
......
......@@ -72,15 +72,15 @@ int Opus::encode(unsigned char *dst, SFLAudioSample *src, size_t buffer_size)
return opus_encode(encoder_, src, FRAME_SIZE, dst, buffer_size * 2);
}
int Opus::decode(std::vector<std::vector<SFLAudioSample> > &dst, unsigned char *buf, size_t buffer_size, size_t dst_offset /* = 0 */)
int Opus::decode(std::vector<std::vector<SFLAudioSample> > &dst, unsigned char *buf, size_t buffer_size)
{
if (buf == NULL || dst.size() < 2) return 0;
interleaved_.resize(4 * FRAME_SIZE);
unsigned samples = opus_decode(decoder_, buf, buffer_size, interleaved_.data(), 2 * FRAME_SIZE, 0);
std::vector<SFLAudioSample>::iterator left_it = dst.at(0).begin() + dst_offset;
std::vector<SFLAudioSample>::iterator right_it = dst.at(1).begin() + dst_offset;
std::vector<SFLAudioSample>::iterator left_it = dst.at(0).begin();
std::vector<SFLAudioSample>::iterator right_it = dst.at(1).begin();
std::vector<opus_int16>::iterator it = interleaved_.begin();
// hard-coded 2-channels as it is the stereo version
......
......@@ -50,7 +50,7 @@ private:
virtual int encode(unsigned char *dst, SFLAudioSample *src, size_t buffer_size);
//multichannel version
virtual int decode(std::vector<std::vector<SFLAudioSample> > &dst, unsigned char *buf, size_t buffer_size, size_t dst_offset=0);
virtual int decode(std::vector<std::vector<SFLAudioSample> > &dst, unsigned char *buf, size_t buffer_size);
virtual int encode(unsigned char *dst, std::vector<std::vector<SFLAudioSample> > &src, size_t buffer_size);
NON_COPYABLE(Opus);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment