Added new capture callback interface to pass the capture callback to a specific voe channel from libjingle webrtcvoiceengine.cc.
The callback has to go through VoEBaseImpl since VoEChannel is internal to voice engine. TEST=compile R=tommi@webrtc.org Review URL: https://webrtc-codereview.appspot.com/7769005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5458 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -183,6 +183,15 @@ public:
|
|||||||
// Gets the NetEQ playout mode for a specified |channel| number.
|
// Gets the NetEQ playout mode for a specified |channel| number.
|
||||||
virtual int GetNetEQPlayoutMode(int channel, NetEqModes& mode) = 0;
|
virtual int GetNetEQPlayoutMode(int channel, NetEqModes& mode) = 0;
|
||||||
|
|
||||||
|
// Method to pass the captured audio data to the specific VoE channel.
|
||||||
|
// |voe_channel| is the id of the VoE channel which is the sink to the
|
||||||
|
// capture data.
|
||||||
|
// TODO(xians): Make the interface pure virtual after libjingle
|
||||||
|
// implements the interface in its FakeWebRtcVoiceEngine.
|
||||||
|
virtual void CaptureCallback(int voe_channel, const void* audio_data,
|
||||||
|
int bits_per_sample, int sample_rate,
|
||||||
|
int number_of_channels,
|
||||||
|
int number_of_frames) {}
|
||||||
protected:
|
protected:
|
||||||
VoEBase() {}
|
VoEBase() {}
|
||||||
virtual ~VoEBase() {}
|
virtual ~VoEBase() {}
|
||||||
|
@ -224,26 +224,33 @@ int VoEBaseImpl::OnDataAvailable(const int voe_channels[],
|
|||||||
// No need to go through the APM, demultiplex the data to each VoE channel,
|
// No need to go through the APM, demultiplex the data to each VoE channel,
|
||||||
// encode and send to the network.
|
// encode and send to the network.
|
||||||
for (int i = 0; i < number_of_voe_channels; ++i) {
|
for (int i = 0; i < number_of_voe_channels; ++i) {
|
||||||
voe::ChannelOwner ch =
|
CaptureCallback(voe_channels[i], audio_data, 16, sample_rate,
|
||||||
_shared->channel_manager().GetChannel(voe_channels[i]);
|
number_of_channels, number_of_frames);
|
||||||
voe::Channel* channel_ptr = ch.channel();
|
|
||||||
if (!channel_ptr)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (channel_ptr->InputIsOnHold()) {
|
|
||||||
channel_ptr->UpdateLocalTimeStamp();
|
|
||||||
} else if (channel_ptr->Sending()) {
|
|
||||||
channel_ptr->Demultiplex(audio_data, sample_rate, number_of_frames,
|
|
||||||
number_of_channels);
|
|
||||||
channel_ptr->PrepareEncodeAndSend(sample_rate);
|
|
||||||
channel_ptr->EncodeAndSend();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return 0 to indicate no need to change the volume.
|
// Return 0 to indicate no need to change the volume.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VoEBaseImpl::CaptureCallback(int voe_channel, const void* audio_data,
|
||||||
|
int bits_per_sample, int sample_rate,
|
||||||
|
int number_of_channels,
|
||||||
|
int number_of_frames) {
|
||||||
|
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(voe_channel);
|
||||||
|
voe::Channel* channel_ptr = ch.channel();
|
||||||
|
if (!channel_ptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (channel_ptr->InputIsOnHold()) {
|
||||||
|
channel_ptr->UpdateLocalTimeStamp();
|
||||||
|
} else if (channel_ptr->Sending()) {
|
||||||
|
channel_ptr->Demultiplex(static_cast<const int16_t*>(audio_data),
|
||||||
|
sample_rate, number_of_frames, number_of_channels);
|
||||||
|
channel_ptr->PrepareEncodeAndSend(sample_rate);
|
||||||
|
channel_ptr->EncodeAndSend();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int VoEBaseImpl::RegisterVoiceEngineObserver(VoiceEngineObserver& observer)
|
int VoEBaseImpl::RegisterVoiceEngineObserver(VoiceEngineObserver& observer)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
|
@ -69,6 +69,10 @@ public:
|
|||||||
|
|
||||||
virtual int LastError();
|
virtual int LastError();
|
||||||
|
|
||||||
|
virtual void CaptureCallback(int voe_channel, const void* audio_data,
|
||||||
|
int bits_per_sample, int sample_rate,
|
||||||
|
int number_of_channels, int number_of_frames);
|
||||||
|
|
||||||
// AudioTransport
|
// AudioTransport
|
||||||
virtual int32_t
|
virtual int32_t
|
||||||
RecordedDataIsAvailable(const void* audioSamples,
|
RecordedDataIsAvailable(const void* audioSamples,
|
||||||
|
Reference in New Issue
Block a user