Commit e4c166d7 authored by Alexandre Lision's avatar Alexandre Lision
Browse files

* #29632 modified opensl layer

added sip_presence in android/callmanager
parent 208ab93c
......@@ -60,6 +60,10 @@ class AudioBuffer {
std::fill(i->begin(), i->end(), 0);
}
inline size_t size() {
return samples_[0].size() * channels() * sizeof(SFLAudioSample);
}
/**
* Returns the sample rate (in samples/sec) associated to this buffer.
*/
......@@ -90,8 +94,8 @@ class AudioBuffer {
* Returns the number of (multichannel) samples in this buffer.
*/
inline size_t samples() const {
return samples_[0].size();
}
return samples_[0].size();
}
/**
* Return the total number of single samples in the buffer (same as samples()*channels()).
......
......@@ -448,7 +448,7 @@ OpenSLLayer::startAudioPlayback()
buffer.reset();
result = (*playbackBufferQueue_)->Enqueue(playbackBufferQueue_, buffer.data(), buffer.size());
result = (*playbackBufferQueue_)->Enqueue(playbackBufferQueue_, &buffer.getData(), buffer.size());
if (SL_RESULT_SUCCESS != result) {
DEBUG("Error could not enqueue initial buffers\n");
......@@ -490,7 +490,7 @@ OpenSLLayer::startAudioCapture()
buffer.reset();
DEBUG("Enqueue record buffer\n");
result = (*recorderBufferQueue_)->Enqueue(recorderBufferQueue_, buffer.data(), buffer.size());
result = (*recorderBufferQueue_)->Enqueue(recorderBufferQueue_, &buffer.getData(), buffer.size());
// the most likely other result is SL_RESULT_BUFFER_INSUFFICIENT,
// which for this code example would indicate a programming error
......@@ -566,9 +566,9 @@ OpenSLLayer::playback(SLAndroidSimpleBufferQueueItf queue)
if (bufferFilled) {
#ifdef RECORD_AUDIO_TODISK
opensl_outfile.write((char const *)(buffer.data()), buffer.size());
opensl_outfile.write((char const *)(&buffer.getData()), buffer.size());
#endif
SLresult result = (*queue)->Enqueue(queue, buffer.data(), buffer.size());
SLresult result = (*queue)->Enqueue(queue, &buffer.getData(), buffer.size());
if (SL_RESULT_SUCCESS != result) {
DEBUG("Error could not enqueue buffers in playback callback\n");
......@@ -597,14 +597,14 @@ OpenSLLayer::capture(SLAndroidSimpleBufferQueueItf queue)
// enqueue an empty buffer to be filled by the recorder
// (for streaming recording, we enqueue at least 2 empty buffers to start things off)
result = (*recorderBufferQueue_)->Enqueue(recorderBufferQueue_, buffer.data(), buffer.size());
result = (*recorderBufferQueue_)->Enqueue(recorderBufferQueue_, &buffer.getData(), buffer.size());
// the most likely other result is SL_RESULT_BUFFER_INSUFFICIENT,
// which for this code example would indicate a programming error
assert(SL_RESULT_SUCCESS == result);
audioCaptureFillBuffer(buffer);
#ifdef RECORD_AUDIO_TODISK
opensl_infile.write((char const *)(buffer.data()), buffer.size());
opensl_infile.write((char const *)(&buffer.getData()), buffer.size());
#endif
}
......
......@@ -58,7 +58,7 @@ AudioFile::onBufferFinish()
if ((updatePlaybackScale_ % 5) == 0) {
CallManager *cm = Manager::instance().getClient()->getCallManager();
cm->updatePlaybackScale(filepath_, pos_ / divisor, buffer_->samples() / divisor);
cm->updatePlaybackScale(pos_ / divisor, buffer_->samples() / divisor);
}
updatePlaybackScale_++;
......
......@@ -490,6 +490,16 @@ void CallManager::registrationStateChanged(const std::string& accoundID, const s
on_account_state_changed_with_code_wrapper(accoundID, state, code);
}
void CallManager::newPresSubClientNotification(const std::string& uri, const std::string& basic, const std::string& note)
{
}
void CallManager::newPresSubServerRequest(const std::string& remote)
{
}
void CallManager::sipCallStateChanged(const std::string& accoundID, const std::string& state, const int32_t& code)
{
......
......@@ -61,6 +61,13 @@ typedef struct callmanager_callback
void (*on_record_playback_filepath) (const std::string& id,
const std::string& filename);
void (*newPresSubClientNotification) (const std::string& uri,
const std::string& basic,
const std::string& note);
void (*newPresSubServerRequest) (const std::string& remote);
} callmanager_callback_t;
......@@ -94,6 +101,12 @@ public:
virtual void on_record_playback_filepath(const std::string& id,
const std::string& filename) {}
virtual void newPresSubClientNotification(const std::string& uri,
const std::string& basic,
const std::string& note) {}
virtual void newPresSubServerRequest(const std::string& remote) {}
};
......@@ -137,10 +150,18 @@ void on_incoming_message_wrapper(const std::string& ID, const std::string& from,
registeredCallbackObject->on_incoming_message(ID, from, msg);
}
void on_record_playback_filepath_wrapper(const std::string& id, const std::string& filename){
void on_record_playback_filepath_wrapper(const std::string& id, const std::string& filename) {
registeredCallbackObject->on_record_playback_filepath(id, filename);
}
void on_newPresSubClientNotification_wrapper(const std::string& uri, const std::string& basic, const std::string& note) {
registeredCallbackObject->newPresSubClientNotification(uri, basic, note);
}
void on_newPresSubServerRequest_wrapper(const std::string& remote) {
registeredCallbackObject->newPresSubServerRequest(remote);
}
static struct callmanager_callback wrapper_callback_struct = {
&on_new_call_created_wrapper,
&on_call_state_changed_wrapper,
......@@ -151,6 +172,8 @@ static struct callmanager_callback wrapper_callback_struct = {
&on_conference_state_changed_wrapper,
&on_incoming_message_wrapper,
&on_record_playback_filepath_wrapper,
&on_newPresSubClientNotification_wrapper,
&on_newPresSubServerRequest_wrapper,
};
void setCallbackObject(Callback* callback) {
......@@ -247,6 +270,12 @@ public:
virtual void on_record_playback_filepath(const std::string& id,
const std::string& filename);
virtual void newPresSubClientNotification(const std::string& uri,
const std::string& basic,
const std::string& note);
virtual void newPresSubServerRequest(const std::string& remote);
};
static Callback* registeredCallbackObject = NULL;
......
......@@ -17,6 +17,8 @@ void on_conference_created_wrapper (const std::string& confID);
void on_conference_removed_wrapper (const std::string& confID);
void on_conference_state_changed_wrapper(const std::string& confID,const std::string& state);
void on_incoming_message_wrapper(const std::string& ID, const std::string& from, const std::string& msg);
void on_newPresSubClientNotification_wrapper(const std::string& uri, const std::string& basic, const std::string& note);
void on_newPresSubServerRequest_wrapper(const std::string& remote);
extern struct configurationmanager_callback wrapper_configurationcallback_struct;
extern void on_accounts_changed_wrapper ();
......
......@@ -178,6 +178,10 @@ class CallManager
void newCallCreated(const std::string&, const std::string&, const std::string&);
void registrationStateChanged(const std::string&, const std::string&, const int32_t&);
void sipCallStateChanged(const std::string&, const std::string&, const int32_t&);
void newPresSubClientNotification(const std::string& uri, const std::string& basic, const std::string& note);
void newPresSubServerRequest(const std::string& remote);
#endif // __ANDROID__
/* Presence subscription/Notification. */
......
Markdown is supported
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