Commit 9308e26d authored by Alexandre Lision's avatar Alexandre Lision
Browse files

* #29866: fixed buffer initialization

parent efb6f574
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <iostream> #include <iostream>
#include "audiobuffer.h" #include "audiobuffer.h"
AudioBuffer::AudioBuffer(size_t sample_num /* = 0 */, unsigned channel_num /* = 1 */, int sample_rate /* = 8000 */) AudioBuffer::AudioBuffer(size_t sample_num, unsigned channel_num /* = 1 */, int sample_rate /* = 8000 */)
: sampleRate_(sample_rate), : sampleRate_(sample_rate),
samples_(std::max(1U, channel_num), samples_(std::max(1U, channel_num),
std::vector<SFLAudioSample>(sample_num, 0)) std::vector<SFLAudioSample>(sample_num, 0))
......
...@@ -147,8 +147,8 @@ OpenSLLayer::OpenSLLayer() ...@@ -147,8 +147,8 @@ OpenSLLayer::OpenSLLayer()
, recorderBufferQueue_(0) , recorderBufferQueue_(0)
, playbackBufferIndex_(0) , playbackBufferIndex_(0)
, recordBufferIndex_(0) , recordBufferIndex_(0)
, playbackBufferStack_(ANDROID_BUFFER_QUEUE_LENGTH, AudioBuffer(0)) , playbackBufferStack_(ANDROID_BUFFER_QUEUE_LENGTH, AudioBuffer(3000))
, recordBufferStack_(ANDROID_BUFFER_QUEUE_LENGTH, AudioBuffer(0)) , recordBufferStack_(ANDROID_BUFFER_QUEUE_LENGTH, AudioBuffer(3000))
{ {
} }
...@@ -490,7 +490,6 @@ OpenSLLayer::startAudioCapture() ...@@ -490,7 +490,6 @@ OpenSLLayer::startAudioCapture()
buffer.reset(); buffer.reset();
DEBUG("Enqueue record buffer\n"); DEBUG("Enqueue record buffer\n");
DEBUG("buffer.getData()[0].size():%d", buffer.getData()[0].size());
result = (*recorderBufferQueue_)->Enqueue(recorderBufferQueue_, buffer.getData()[0].data(), buffer.getData()[0].size()); result = (*recorderBufferQueue_)->Enqueue(recorderBufferQueue_, buffer.getData()[0].data(), buffer.getData()[0].size());
// the most likely other result is SL_RESULT_BUFFER_INSUFFICIENT, // the most likely other result is SL_RESULT_BUFFER_INSUFFICIENT,
......
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