Remove external encryption API for VoE.

BUG=
R=henrika@webrtc.org, henrikg@webrtc.org, phoglund@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/8459004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5564 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
solenberg@webrtc.org 2014-02-18 11:27:22 +00:00
parent 0a9d822812
commit a07923339b
32 changed files with 16 additions and 1349 deletions

View File

@ -157,71 +157,6 @@ enum FrameType
kVideoFrameDelta = 4, // depends on the previus frame
};
// Interface for encrypting and decrypting regular data and rtp/rtcp packets.
// Implement this interface if you wish to provide an encryption scheme to
// the voice or video engines.
class Encryption
{
public:
// Encrypt the given data.
//
// Args:
// channel: The channel to encrypt data for.
// in_data: The data to encrypt. This data is bytes_in bytes long.
// out_data: The buffer to write the encrypted data to. You may write more
// bytes of encrypted data than what you got as input, up to a maximum
// of webrtc::kViEMaxMtu if you are encrypting in the video engine, or
// webrtc::kVoiceEngineMaxIpPacketSizeBytes for the voice engine.
// bytes_in: The number of bytes in the input buffer.
// bytes_out: The number of bytes written in out_data.
virtual void encrypt(
int channel,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) = 0;
// Decrypts the given data. This should reverse the effects of encrypt().
//
// Args:
// channel_no: The channel to decrypt data for.
// in_data: The data to decrypt. This data is bytes_in bytes long.
// out_data: The buffer to write the decrypted data to. You may write more
// bytes of decrypted data than what you got as input, up to a maximum
// of webrtc::kViEMaxMtu if you are encrypting in the video engine, or
// webrtc::kVoiceEngineMaxIpPacketSizeBytes for the voice engine.
// bytes_in: The number of bytes in the input buffer.
// bytes_out: The number of bytes written in out_data.
virtual void decrypt(
int channel,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) = 0;
// Encrypts a RTCP packet. Otherwise, this method has the same contract as
// encrypt().
virtual void encrypt_rtcp(
int channel,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) = 0;
// Decrypts a RTCP packet. Otherwise, this method has the same contract as
// decrypt().
virtual void decrypt_rtcp(
int channel,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) = 0;
protected:
virtual ~Encryption() {}
Encryption() {}
};
// External transport callback interface
class Transport
{

View File

@ -86,7 +86,6 @@
#ifndef WEBRTC_CHROMIUM_BUILD
#define WEBRTC_VOICE_ENGINE_CALL_REPORT_API
#define WEBRTC_VOICE_ENGINE_ENCRYPTION_API
#endif
// ============================================================================

View File

@ -30,7 +30,6 @@ _HOME = os.environ.get('HOME', '')
_VIE_AUTO_TEST_CMD_LIST = [
'vie_auto_test',
'--automated',
'--gtest_filter=-ViERtpFuzzTest*',
'--capture_test_ensure_resolution_alignment_in_capture_device=false']
_WIN_TESTS = {
'vie_auto_test': _VIE_AUTO_TEST_CMD_LIST,
@ -51,8 +50,7 @@ _MAC_TESTS = {
_LINUX_TESTS = {
'vie_auto_test': _VIE_AUTO_TEST_CMD_LIST,
'voe_auto_test': ['voe_auto_test',
'--automated',
'--gtest_filter=-RtpFuzzTest.*'],
'--automated'],
'audio_e2e_test': ['python',
'run_audio_test.py',
'--input=../../resources/e2e_audio_in.pcm',

View File

@ -1,73 +0,0 @@
/*
* Copyright (c) 2012 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.
*/
#include "webrtc/test/libtest/include/bit_flip_encryption.h"
#include <stdlib.h>
float NormalizedRand() {
return static_cast<float>(rand()) /
static_cast<float>(RAND_MAX);
}
BitFlipEncryption::BitFlipEncryption(unsigned int rand_seed,
float flip_probability)
: flip_probability_(flip_probability),
flip_count_(0) {
srand(rand_seed);
}
void BitFlipEncryption::FlipSomeBitsInData(const unsigned char* in_data,
unsigned char* out_data,
int bytes_in, int* bytes_out) {
for (int i = 0; i < bytes_in; i++) {
out_data[i] = in_data[i];
if (NormalizedRand() < flip_probability_) {
int bit_to_flip = rand() % 8;
out_data[i] ^= 1 << bit_to_flip;
flip_count_++;
}
}
*bytes_out = bytes_in;
}
void BitFlipEncryption::encrypt(int channel_no,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) {
FlipSomeBitsInData(in_data, out_data, bytes_in, bytes_out);
}
void BitFlipEncryption::decrypt(int channel_no,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) {
FlipSomeBitsInData(in_data, out_data, bytes_in, bytes_out);
}
void BitFlipEncryption::encrypt_rtcp(int channel_no,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) {
FlipSomeBitsInData(in_data, out_data, bytes_in, bytes_out);
}
void BitFlipEncryption::decrypt_rtcp(int channel_no,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) {
FlipSomeBitsInData(in_data, out_data, bytes_in, bytes_out);
}

View File

@ -1,47 +0,0 @@
/*
* Copyright (c) 2012 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.
*/
#include "webrtc/test/libtest/include/random_encryption.h"
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include "webrtc/video_engine/vie_defines.h"
static int Saturate(int value, int min, int max) {
return std::min(std::max(value, min), max);
}
RandomEncryption::RandomEncryption(unsigned int rand_seed) {
srand(rand_seed);
}
// Generates some completely random data with roughly the right length.
void RandomEncryption::GenerateRandomData(unsigned char* out_data, int bytes_in,
int* bytes_out) {
int out_length = MakeUpSimilarLength(bytes_in);
for (int i = 0; i < out_length; i++) {
// The modulo will skew the random distribution a bit, but I think it
// will be random enough.
out_data[i] = static_cast<unsigned char>(rand() % 256);
}
*bytes_out = out_length;
}
// Makes up a length within +- 50 of the original length, without
// overstepping the contract for encrypt / decrypt.
int RandomEncryption::MakeUpSimilarLength(int original_length) {
int sign = rand() - RAND_MAX / 2;
int length = original_length + sign * rand() % 50;
return Saturate(length, 0, static_cast<int>(webrtc::kViEMaxMtu));
}

View File

@ -1,63 +0,0 @@
/*
* Copyright (c) 2012 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 SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_BIT_FLIP_ENCRYPTION_H_
#define SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_BIT_FLIP_ENCRYPTION_H_
#include "webrtc/common_types.h"
// This encryption scheme will randomly flip bits every now and then in the
// input data.
class BitFlipEncryption : public webrtc::Encryption {
public:
// Args:
// rand_seed: the seed to initialize the test's random generator with.
// flip_probability: A number [0, 1] which is the percentage chance a bit
// gets flipped in a particular byte.
BitFlipEncryption(unsigned int rand_seed, float flip_probability);
virtual void encrypt(int channel_no,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) OVERRIDE;
virtual void decrypt(int channel_no,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) OVERRIDE;
virtual void encrypt_rtcp(int channel_no,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) OVERRIDE;
virtual void decrypt_rtcp(int channel_no,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) OVERRIDE;
int64_t flip_count() const { return flip_count_; }
private:
// The flip probability ([0, 1]).
float flip_probability_;
// The number of bits we've flipped so far.
int64_t flip_count_;
// Flips some bits in the data at random.
void FlipSomeBitsInData(const unsigned char *in_data, unsigned char* out_data,
int bytes_in, int* bytes_out);
};
#endif // SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_BIT_FLIP_ENCRYPTION_H_

View File

@ -1,65 +0,0 @@
/*
* Copyright (c) 2012 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 SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_RANDOM_ENCRYPTION_H_
#define SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_RANDOM_ENCRYPTION_H_
#include "webrtc/common_types.h"
// These algorithms attempt to create an uncrackable encryption
// scheme by completely disregarding the input data.
class RandomEncryption : public webrtc::Encryption {
public:
explicit RandomEncryption(unsigned int rand_seed);
virtual void encrypt(int channel_no,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) OVERRIDE {
GenerateRandomData(out_data, bytes_in, bytes_out);
}
virtual void decrypt(int channel_no,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) OVERRIDE {
GenerateRandomData(out_data, bytes_in, bytes_out);
}
virtual void encrypt_rtcp(int channel_no,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) OVERRIDE {
GenerateRandomData(out_data, bytes_in, bytes_out);
}
virtual void decrypt_rtcp(int channel_no,
unsigned char* in_data,
unsigned char* out_data,
int bytes_in,
int* bytes_out) OVERRIDE {
GenerateRandomData(out_data, bytes_in, bytes_out);
}
private:
// Generates some completely random data with roughly the right length.
void GenerateRandomData(unsigned char* out_data,
int bytes_in,
int* bytes_out);
// Makes up a length within +- 50 of the original length, without
// overstepping the contract for encrypt / decrypt.
int MakeUpSimilarLength(int original_length);
};
#endif // SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_RANDOM_ENCRYPTION_H_

View File

@ -1,26 +0,0 @@
# Copyright (c) 2012 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.
{
'includes': [
'../../build/common.gypi'
],
'targets': [
{
'target_name': 'libtest',
'type': 'static_library',
'sources': [
# Helper classes
'include/bit_flip_encryption.h',
'include/random_encryption.h',
'helpers/bit_flip_encryption.cc',
'helpers/random_encryption.cc',
],
},
],
}

View File

@ -19,7 +19,6 @@
<item>Capture</item>
<item>Codec</item>
<item>Mix</item>
<item>Encryption</item>
<item>External Codec</item>
<item>File</item>
<item>Image Process</item>

View File

@ -21,7 +21,6 @@
'<(webrtc_root)/test/metrics.gyp:metrics',
'<(webrtc_root)/test/test.gyp:channel_transport',
'<(webrtc_root)/test/test.gyp:test_support',
'<(webrtc_root)/test/libtest/libtest.gyp:libtest',
'video_engine_core',
'libvietest',
],

View File

@ -35,7 +35,6 @@ LOCAL_SRC_FILES := \
voe_call_report_impl.cc \
voe_codec_impl.cc \
voe_dtmf_impl.cc \
voe_encryption_impl.cc \
voe_external_media_impl.cc \
voe_file_impl.cc \
voe_hardware_impl.cc \
@ -66,12 +65,12 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../../modules/rtp_rtcp/interface \
$(LOCAL_PATH)/../../../modules/udp_transport/interface \
$(LOCAL_PATH)/../../../modules/utility/interface \
$(LOCAL_PATH)/../../../system_wrappers/interface
$(LOCAL_PATH)/../../../system_wrappers/interface
LOCAL_SHARED_LIBRARIES := \
libcutils \
libdl \
libstlport
libstlport
ifeq ($(TARGET_OS)-$(TARGET_SIMULATOR),linux-true)
LOCAL_LDLIBS += -ldl -lpthread

View File

@ -205,41 +205,6 @@ Channel::SendPacket(int channel, const void *data, int len)
"Channel::SendPacket() RTP dump to output file failed");
}
// SRTP or External encryption
if (_encrypting)
{
if (_encryptionPtr)
{
if (!_encryptionRTPBufferPtr)
{
// Allocate memory for encryption buffer one time only
_encryptionRTPBufferPtr =
new uint8_t[kVoiceEngineMaxIpPacketSizeBytes];
memset(_encryptionRTPBufferPtr, 0,
kVoiceEngineMaxIpPacketSizeBytes);
}
// Perform encryption (SRTP or external)
int32_t encryptedBufferLength = 0;
_encryptionPtr->encrypt(_channelId,
bufferToSendPtr,
_encryptionRTPBufferPtr,
bufferLength,
(int*)&encryptedBufferLength);
if (encryptedBufferLength <= 0)
{
_engineStatisticsPtr->SetLastError(
VE_ENCRYPTION_FAILED,
kTraceError, "Channel::SendPacket() encryption failed");
return -1;
}
// Replace default data buffer with encrypted buffer
bufferToSendPtr = _encryptionRTPBufferPtr;
bufferLength = encryptedBufferLength;
}
}
int n = _transportPtr->SendPacket(channel, bufferToSendPtr,
bufferLength);
if (n < 0) {
@ -284,39 +249,6 @@ Channel::SendRTCPPacket(int channel, const void *data, int len)
"Channel::SendPacket() RTCP dump to output file failed");
}
// SRTP or External encryption
if (_encrypting)
{
if (_encryptionPtr)
{
if (!_encryptionRTCPBufferPtr)
{
// Allocate memory for encryption buffer one time only
_encryptionRTCPBufferPtr =
new uint8_t[kVoiceEngineMaxIpPacketSizeBytes];
}
// Perform encryption (SRTP or external).
int32_t encryptedBufferLength = 0;
_encryptionPtr->encrypt_rtcp(_channelId,
bufferToSendPtr,
_encryptionRTCPBufferPtr,
bufferLength,
(int*)&encryptedBufferLength);
if (encryptedBufferLength <= 0)
{
_engineStatisticsPtr->SetLastError(
VE_ENCRYPTION_FAILED, kTraceError,
"Channel::SendRTCPPacket() encryption failed");
return -1;
}
// Replace default data buffer with encrypted buffer
bufferToSendPtr = _encryptionRTCPBufferPtr;
bufferLength = encryptedBufferLength;
}
}
int n = _transportPtr->SendRTCPPacket(channel,
bufferToSendPtr,
bufferLength);
@ -952,10 +884,6 @@ Channel::Channel(int32_t channelId,
_outputExternalMedia(false),
_inputExternalMediaCallbackPtr(NULL),
_outputExternalMediaCallbackPtr(NULL),
_encryptionRTPBufferPtr(NULL),
_decryptionRTPBufferPtr(NULL),
_encryptionRTCPBufferPtr(NULL),
_decryptionRTCPBufferPtr(NULL),
_timeStamp(0), // This is just an offset, RTP module will add it's own random offset
_sendTelephoneEventPayloadType(106),
jitter_buffer_playout_timestamp_(0),
@ -972,7 +900,6 @@ Channel::Channel(int32_t channelId,
_voiceEngineObserverPtr(NULL),
_callbackCritSectPtr(NULL),
_transportPtr(NULL),
_encryptionPtr(NULL),
rx_audioproc_(AudioProcessing::Create(VoEModuleId(instanceId, channelId))),
_rxVadObserverPtr(NULL),
_oldVadDecision(-1),
@ -993,8 +920,6 @@ Channel::Channel(int32_t channelId,
_panLeft(1.0f),
_panRight(1.0f),
_outputGain(1.0f),
_encrypting(false),
_decrypting(false),
_playOutbandDtmfEvent(false),
_playInbandDtmfEvent(false),
_extraPayloadType(0),
@ -1115,10 +1040,6 @@ Channel::~Channel()
// Delete other objects
RtpDump::DestroyRtpDump(&_rtpDumpIn);
RtpDump::DestroyRtpDump(&_rtpDumpOut);
delete [] _encryptionRTPBufferPtr;
delete [] _decryptionRTPBufferPtr;
delete [] _encryptionRTCPBufferPtr;
delete [] _decryptionRTCPBufferPtr;
delete &_callbackCritSect;
delete &_fileCritSect;
delete &volume_settings_critsect_;
@ -3035,54 +2956,6 @@ Channel::GetChannelOutputVolumeScaling(float& scaling) const
return 0;
}
int
Channel::RegisterExternalEncryption(Encryption& encryption)
{
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::RegisterExternalEncryption()");
CriticalSectionScoped cs(&_callbackCritSect);
if (_encryptionPtr)
{
_engineStatisticsPtr->SetLastError(
VE_INVALID_OPERATION, kTraceError,
"RegisterExternalEncryption() encryption already enabled");
return -1;
}
_encryptionPtr = &encryption;
_decrypting = true;
_encrypting = true;
return 0;
}
int
Channel::DeRegisterExternalEncryption()
{
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::DeRegisterExternalEncryption()");
CriticalSectionScoped cs(&_callbackCritSect);
if (!_encryptionPtr)
{
_engineStatisticsPtr->SetLastError(
VE_INVALID_OPERATION, kTraceWarning,
"DeRegisterExternalEncryption() encryption already disabled");
return 0;
}
_decrypting = false;
_encrypting = false;
_encryptionPtr = NULL;
return 0;
}
int Channel::SendTelephoneEventOutband(unsigned char eventCode,
int lengthMs, int attenuationDb,
bool playDtmfEvent)

View File

@ -218,10 +218,6 @@ public:
// VoEVideoSyncExtended
int GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const;
// VoEEncryption
int RegisterExternalEncryption(Encryption& encryption);
int DeRegisterExternalEncryption();
// VoEDtmf
int SendTelephoneEventOutband(unsigned char eventCode, int lengthMs,
int attenuationDb, bool playDtmfEvent);
@ -484,10 +480,6 @@ private:
bool _outputExternalMedia;
VoEMediaProcess* _inputExternalMediaCallbackPtr;
VoEMediaProcess* _outputExternalMediaCallbackPtr;
uint8_t* _encryptionRTPBufferPtr;
uint8_t* _decryptionRTPBufferPtr;
uint8_t* _encryptionRTCPBufferPtr;
uint8_t* _decryptionRTCPBufferPtr;
uint32_t _timeStamp;
uint8_t _sendTelephoneEventPayloadType;
@ -509,7 +501,6 @@ private:
VoiceEngineObserver* _voiceEngineObserverPtr; // owned by base
CriticalSectionWrapper* _callbackCritSectPtr; // owned by base
Transport* _transportPtr; // WebRtc socket or external transport
Encryption* _encryptionPtr; // WebRtc SRTP or external encryption
scoped_ptr<AudioProcessing> rtp_audioproc_;
scoped_ptr<AudioProcessing> rx_audioproc_; // far end AudioProcessing
VoERxVadCallback* _rxVadObserverPtr;
@ -533,9 +524,6 @@ private:
float _panLeft;
float _panRight;
float _outputGain;
// VoEEncryption
bool _encrypting;
bool _decrypting;
// VoEDtmf
bool _playOutbandDtmfEvent;
bool _playInbandDtmfEvent;

View File

@ -1,63 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
// This sub-API supports the following functionalities:
//
// - External encryption and decryption.
//
// Usage example, omitting error checking:
//
// using namespace webrtc;
// VoiceEngine* voe = VoiceEngine::Create();
// VoEEncryption* encrypt = VoEEncryption::GetInterface(voe);
// ...
// encrypt->Release();
// VoiceEngine::Delete(voe);
//
#ifndef WEBRTC_VOICE_ENGINE_VOE_ENCRYPTION_H
#define WEBRTC_VOICE_ENGINE_VOE_ENCRYPTION_H
#include "webrtc/common_types.h"
namespace webrtc {
class VoiceEngine;
class WEBRTC_DLLEXPORT VoEEncryption
{
public:
// Factory for the VoEEncryption sub-API. Increases an internal
// reference counter if successful. Returns NULL if the API is not
// supported or if construction fails.
static VoEEncryption* GetInterface(VoiceEngine* voiceEngine);
// Releases the VoEEncryption sub-API and decreases an internal
// reference counter. Returns the new reference count. This value should
// be zero for all sub-API:s before the VoiceEngine object can be safely
// deleted.
virtual int Release() = 0;
// Installs an Encryption instance and enables external encryption
// for the selected |channel|.
virtual int RegisterExternalEncryption(
int channel, Encryption& encryption) = 0;
// Removes an Encryption instance and disables external encryption
// for the selected |channel|.
virtual int DeRegisterExternalEncryption(int channel) = 0;
protected:
VoEEncryption() {}
virtual ~VoEEncryption() {}
};
} // namespace webrtc
#endif // WEBRTC_VOICE_ENGINE_VOE_ENCRYPTION_H

View File

@ -36,7 +36,7 @@
#define VE_DTMF_OUTOF_RANGE 8022
#define VE_INVALID_CHANNELS 8023
#define VE_SET_PLTYPE_FAILED 8024
#define VE_ENCRYPT_NOT_INITED 8025
// 8025 is not used
#define VE_NOT_INITED 8026
#define VE_NOT_SENDING 8027
#define VE_EXT_TRANSPORT_NOT_SUPPORTED 8028
@ -114,8 +114,8 @@
#define VE_RTP_KEEPALIVE_FAILED 9023
#define VE_SEND_DTMF_FAILED 9024
#define VE_CANNOT_RETRIEVE_CNAME 9025
#define VE_DECRYPTION_FAILED 9026
#define VE_ENCRYPTION_FAILED 9027
// 9026 is not used
// 9027 is not used
#define VE_CANNOT_RETRIEVE_RTP_STAT 9028
#define VE_GQOS_ERROR 9029
#define VE_BINDING_SOCKET_TO_LOCAL_ADDRESS_FAILED 9030

View File

@ -20,7 +20,6 @@
#include "webrtc/voice_engine/include/voe_audio_processing.h"
#include "webrtc/voice_engine/include/voe_base.h"
#include "webrtc/voice_engine/include/voe_codec.h"
#include "webrtc/voice_engine/include/voe_encryption.h"
#include "webrtc/voice_engine/include/voe_file.h"
#include "webrtc/voice_engine/include/voe_hardware.h"
#include "webrtc/voice_engine/include/voe_network.h"
@ -89,13 +88,6 @@
"RTP / RTCP pointer doesn't exist"); \
return -1; \
}
#define VALIDATE_ENCRYPT_POINTER \
if (!veData1.encrypt) \
{ \
__android_log_write(ANDROID_LOG_ERROR, WEBRTC_LOG_TAG, \
"Encrypt pointer doesn't exist"); \
return -1; \
}
// Register functions in JNI_OnLoad()
// How do we ensure that VoE is deleted? JNI_OnUnload?
@ -116,32 +108,6 @@ enum TestType
CPU = 4
};
// ExtendedSelection enumerator
enum ExtendedSelection
{
XSEL_Invalid = -1,
XSEL_None = 0,
XSEL_All,
XSEL_Base,
XSEL_CallReport,
XSEL_Codec,
XSEL_DTMF,
XSEL_Encryption,
XSEL_ExternalMedia,
XSEL_File,
XSEL_Hardware,
XSEL_NetEqStats,
XSEL_Network,
XSEL_PTT,
XSEL_RTP_RTCP,
XSEL_VideoSync,
XSEL_VideoSyncExtended,
XSEL_VolumeControl,
XSEL_VQE,
XSEL_APM,
XSEL_VQMon
};
using namespace webrtc;
class my_transportation;
@ -160,7 +126,6 @@ typedef struct
VoEVolumeControl* volume;
VoEHardware* hardware;
VoERTP_RTCP* rtp_rtcp;
VoEEncryption* encrypt;
// Other
my_transportation* extTrans;
JavaVM* jvm;
@ -447,80 +412,12 @@ JNIEXPORT jint JNICALL Java_org_webrtc_voiceengine_test_AndroidTest_RunAutoTest(
return -1;
}
ExtendedSelection xsel(XSEL_Invalid);
switch (extendedSel)
{
case 0:
xsel = XSEL_None;
break;
case 1:
xsel = XSEL_All;
break;
case 2:
xsel = XSEL_Base;
break;
case 3:
xsel = XSEL_CallReport;
break;
case 4:
xsel = XSEL_Codec;
break;
case 5:
xsel = XSEL_DTMF;
break;
case 6:
xsel = XSEL_Encryption;
break;
case 7:
xsel = XSEL_ExternalMedia;
break;
case 8:
xsel = XSEL_File;
break;
case 9:
xsel = XSEL_Hardware;
break;
case 10:
xsel = XSEL_NetEqStats;
break;
case 11:
xsel = XSEL_Network;
break;
case 12:
xsel = XSEL_PTT;
break;
case 13:
xsel = XSEL_RTP_RTCP;
break;
case 14:
xsel = XSEL_VideoSync;
break;
case 15:
xsel = XSEL_VideoSyncExtended;
break;
case 16:
xsel = XSEL_VolumeControl;
break;
case 17:
xsel = XSEL_APM;
break;
case 18:
xsel = XSEL_VQMon;
break;
default:
xsel = XSEL_Invalid;
__android_log_write(ANDROID_LOG_ERROR, WEBRTC_LOG_TAG,
"RunAutoTest - Invalid extendedType");
return -1;
}
// Set instance independent Java objects
VoiceEngine::SetAndroidObjects(veData1.jvm, env, context);
// Call voe test interface function
// TODO(leozwang) add autotest setAndroidObjects(veData1.jvm, context);
// jint retVal = runAutoTest(tType, xsel);
// jint retVal = runAutoTest(tType);
// Clear instance independent Java objects
VoiceEngine::SetAndroidObjects(NULL, NULL, NULL);
@ -1348,15 +1245,6 @@ bool GetSubApis(VoiceEngineData &veData)
getOK = false;
}
// Encrypt
veData.encrypt = VoEEncryption::GetInterface(veData.ve);
if (!veData.encrypt)
{
__android_log_write(ANDROID_LOG_ERROR, WEBRTC_LOG_TAG,
"Get encrypt sub-API failed");
getOK = false;
}
return getOK;
}
@ -1487,20 +1375,5 @@ bool ReleaseSubApis(VoiceEngineData &veData)
}
}
// Encrypt
if (veData.encrypt)
{
if (0 != veData.encrypt->Release())
{
__android_log_write(ANDROID_LOG_ERROR, WEBRTC_LOG_TAG,
"Release encrypt sub-API failed");
releaseOK = false;
}
else
{
veData.encrypt = NULL;
}
}
return releaseOK;
}

View File

@ -34,7 +34,6 @@ BeforeInitializationFixture::BeforeInitializationFixture() {
voe_network_ = webrtc::VoENetwork::GetInterface(voice_engine_);
voe_file_ = webrtc::VoEFile::GetInterface(voice_engine_);
voe_vsync_ = webrtc::VoEVideoSync::GetInterface(voice_engine_);
voe_encrypt_ = webrtc::VoEEncryption::GetInterface(voice_engine_);
voe_hardware_ = webrtc::VoEHardware::GetInterface(voice_engine_);
voe_xmedia_ = webrtc::VoEExternalMedia::GetInterface(voice_engine_);
voe_call_report_ = webrtc::VoECallReport::GetInterface(voice_engine_);
@ -51,7 +50,6 @@ BeforeInitializationFixture::~BeforeInitializationFixture() {
voe_network_->Release();
voe_file_->Release();
voe_vsync_->Release();
voe_encrypt_->Release();
voe_hardware_->Release();
voe_xmedia_->Release();
voe_call_report_->Release();

View File

@ -22,7 +22,6 @@
#include "webrtc/voice_engine/include/voe_call_report.h"
#include "webrtc/voice_engine/include/voe_codec.h"
#include "webrtc/voice_engine/include/voe_dtmf.h"
#include "webrtc/voice_engine/include/voe_encryption.h"
#include "webrtc/voice_engine/include/voe_errors.h"
#include "webrtc/voice_engine/include/voe_external_media.h"
#include "webrtc/voice_engine/include/voe_file.h"
@ -67,7 +66,6 @@ class BeforeInitializationFixture : public testing::Test {
webrtc::VoENetwork* voe_network_;
webrtc::VoEFile* voe_file_;
webrtc::VoEVideoSync* voe_vsync_;
webrtc::VoEEncryption* voe_encrypt_;
webrtc::VoEHardware* voe_hardware_;
webrtc::VoEExternalMedia* voe_xmedia_;
webrtc::VoECallReport* voe_call_report_;

View File

@ -1,48 +0,0 @@
/*
* Copyright (c) 2012 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.
*/
#include <time.h>
#include "webrtc/test/libtest/include/bit_flip_encryption.h"
#include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h"
class RtpFuzzTest : public AfterStreamingFixture {
protected:
void BitFlipFuzzTest(float flip_probability) {
BitFlipEncryption bit_flip_encryption(time(NULL), flip_probability);
TEST_LOG("Starting to flip bits in RTP/RTCP packets.\n");
voe_encrypt_->RegisterExternalEncryption(channel_, bit_flip_encryption);
Sleep(5000);
voe_encrypt_->DeRegisterExternalEncryption(channel_);
TEST_LOG("Flipped %d bits. Back to normal.\n",
static_cast<int>(bit_flip_encryption.flip_count()));
Sleep(2000);
}
};
TEST_F(RtpFuzzTest, VoiceEngineDealsWithASmallNumberOfTamperedRtpPackets) {
BitFlipFuzzTest(0.00005f);
}
TEST_F(RtpFuzzTest, VoiceEngineDealsWithAMediumNumberOfTamperedRtpPackets) {
BitFlipFuzzTest(0.0005f);
}
TEST_F(RtpFuzzTest, VoiceEngineDealsWithALargeNumberOfTamperedRtpPackets) {
BitFlipFuzzTest(0.05f);
}
TEST_F(RtpFuzzTest, VoiceEngineDealsWithAHugeNumberOfTamperedRtpPackets) {
BitFlipFuzzTest(0.5f);
}

View File

@ -1,80 +0,0 @@
/*
* Copyright (c) 2012 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.
*/
#include "webrtc/voice_engine/include/voe_encryption.h"
#include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h"
class BasicBitInverseEncryption : public webrtc::Encryption {
void encrypt(int channel_no, unsigned char* in_data,
unsigned char* out_data, int bytes_in, int* bytes_out);
void decrypt(int channel_no, unsigned char* in_data,
unsigned char* out_data, int bytes_in, int* bytes_out);
void encrypt_rtcp(int channel_no, unsigned char* in_data,
unsigned char* out_data, int bytes_in, int* bytes_out);
void decrypt_rtcp(int channel_no, unsigned char* in_data,
unsigned char* out_data, int bytes_in, int* bytes_out);
};
void BasicBitInverseEncryption::encrypt(int, unsigned char* in_data,
unsigned char* out_data,
int bytes_in, int* bytes_out) {
int i;
for (i = 0; i < bytes_in; i++)
out_data[i] = ~in_data[i];
out_data[bytes_in] = 0;
out_data[bytes_in + 1] = 0;
*bytes_out = bytes_in + 2;
}
void BasicBitInverseEncryption::decrypt(int, unsigned char* in_data,
unsigned char* out_data,
int bytes_in, int* bytes_out) {
int i;
for (i = 0; i < bytes_in; i++)
out_data[i] = ~in_data[i];
*bytes_out = bytes_in - 2;
}
void BasicBitInverseEncryption::encrypt_rtcp(int, unsigned char* in_data,
unsigned char* out_data,
int bytes_in, int* bytes_out) {
int i;
for (i = 0; i < bytes_in; i++)
out_data[i] = ~in_data[i];
out_data[bytes_in] = 0;
out_data[bytes_in + 1] = 0;
*bytes_out = bytes_in + 2;
}
void BasicBitInverseEncryption::decrypt_rtcp(int, unsigned char* in_data,
unsigned char* out_data,
int bytes_in, int* bytes_out) {
int i;
for (i = 0; i < bytes_in; i++)
out_data[i] = ~in_data[i];
out_data[bytes_in] = 0;
out_data[bytes_in + 1] = 0;
*bytes_out = bytes_in + 2;
}
class EncryptionTest : public AfterStreamingFixture {
};
TEST_F(EncryptionTest, ManualBasicCorrectExternalEncryptionHasNoEffectOnVoice) {
BasicBitInverseEncryption basic_encryption;
voe_encrypt_->RegisterExternalEncryption(channel_, basic_encryption);
TEST_LOG("Registered external encryption, should still hear good audio.\n");
Sleep(3000);
voe_encrypt_->DeRegisterExternalEncryption(channel_);
}

View File

@ -49,8 +49,6 @@ void SubAPIManager::DisplayStatus() const {
TEST_LOG(" Codec\n");
if (_dtmf)
TEST_LOG(" Dtmf\n");
if (_encryption)
TEST_LOG(" Encryption\n");
if (_externalMedia)
TEST_LOG(" ExternalMedia\n");
if (_file)
@ -79,8 +77,6 @@ void SubAPIManager::DisplayStatus() const {
TEST_LOG(" Codec\n");
if (!_dtmf)
TEST_LOG(" Dtmf\n");
if (!_encryption)
TEST_LOG(" Encryption\n");
if (!_externalMedia)
TEST_LOG(" ExternamMedia\n");
if (!_file)
@ -109,7 +105,6 @@ VoETestManager::VoETestManager()
voe_call_report_(0),
voe_codec_(0),
voe_dtmf_(0),
voe_encrypt_(0),
voe_xmedia_(0),
voe_file_(0),
voe_hardware_(0),
@ -165,7 +160,6 @@ void VoETestManager::GetInterfaces() {
#ifdef _TEST_VIDEO_SYNC_
voe_vsync_ = VoEVideoSync::GetInterface(voice_engine_);
#endif
voe_encrypt_ = VoEEncryption::GetInterface(voice_engine_);
voe_hardware_ = VoEHardware::GetInterface(voice_engine_);
// Set the audio layer to use in all tests
if (voe_hardware_) {
@ -231,10 +225,6 @@ int VoETestManager::ReleaseInterfaces() {
voe_vsync_ = NULL;
}
#endif
if (voe_encrypt_) {
voe_encrypt_->Release();
voe_encrypt_ = NULL;
}
if (voe_hardware_) {
voe_hardware_->Release();
voe_hardware_ = NULL;

View File

@ -31,9 +31,6 @@
#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
#include "webrtc/voice_engine/include/voe_codec.h"
#endif
#ifdef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
#include "webrtc/voice_engine/include/voe_encryption.h"
#endif
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
#include "webrtc/voice_engine/include/voe_external_media.h"
#endif
@ -71,7 +68,6 @@ class SubAPIManager {
_callReport(false),
_codec(false),
_dtmf(false),
_encryption(false),
_externalMedia(false),
_file(false),
_hardware(false),
@ -90,9 +86,6 @@ class SubAPIManager {
#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
_dtmf = true;
#endif
#ifdef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
_encryption = true;
#endif
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
_externalMedia = true;
#endif
@ -123,7 +116,7 @@ class SubAPIManager {
void DisplayStatus() const;
private:
bool _base, _callReport, _codec, _dtmf, _encryption;
bool _base, _callReport, _codec, _dtmf;
bool _externalMedia, _file, _hardware;
bool _netEqStats, _network, _rtp_rtcp, _videoSync, _volumeControl, _apm;
};
@ -185,10 +178,6 @@ class VoETestManager {
return voe_vsync_;
}
VoEEncryption* EncryptionPtr() const {
return voe_encrypt_;
}
VoEExternalMedia* ExternalMediaPtr() const {
return voe_xmedia_;
}
@ -211,7 +200,6 @@ class VoETestManager {
VoECallReport* voe_call_report_;
VoECodec* voe_codec_;
VoEDtmf* voe_dtmf_;
VoEEncryption* voe_encrypt_;
VoEExternalMedia* voe_xmedia_;
VoEFile* voe_file_;
VoEHardware* voe_hardware_;

View File

@ -30,7 +30,6 @@
#define _TEST_NETWORK_
#define _TEST_CALL_REPORT_
#define _TEST_VIDEO_SYNC_
#define _TEST_ENCRYPT_
#define _TEST_NETEQ_STATS_
#define _TEST_XMEDIA_
@ -69,9 +68,6 @@
#ifndef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
#undef _TEST_VIDEO_SYNC_
#endif
#ifndef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
#undef _TEST_ENCRYPT_
#endif
#ifndef WEBRTC_VOICE_ENGINE_HARDWARE_API
#undef _TEST_HARDWARE_
#endif

View File

@ -53,119 +53,8 @@ namespace voetest {
//
const int dTBetweenEachTest = 4000;
// ----------------------------------------------------------------------------
// Encrypt
// ----------------------------------------------------------------------------
void VoEUnitTest::encrypt(int channel_no, unsigned char * in_data,
unsigned char * out_data, int bytes_in,
int * bytes_out) {
int i;
if (!_extOnOff) {
// no stereo emulation <=> pure bypass
for (i = 0; i < bytes_in; i++)
out_data[i] = in_data[i];
*bytes_out = bytes_in;
} else if (_extOnOff && (_extBitsPerSample == 16)) {
// stereo emulation (sample based, 2 bytes per sample)
const int nBytesPayload = bytes_in - 12;
// RTP header (first 12 bytes)
memcpy(out_data, in_data, 12);
// skip RTP header
short* ptrIn = (short*) &in_data[12];
short* ptrOut = (short*) &out_data[12];
// network byte order
for (i = 0; i < nBytesPayload / 2; i++) {
// produce two output samples for each input sample
*ptrOut++ = *ptrIn; // left sample
*ptrOut++ = *ptrIn; // right sample
ptrIn++;
}
*bytes_out = 12 + 2 * nBytesPayload;
} else if (_extOnOff && (_extBitsPerSample == 8)) {
// stereo emulation (sample based, 1 bytes per sample)
const int nBytesPayload = bytes_in - 12;
// RTP header (first 12 bytes)
memcpy(out_data, in_data, 12);
// skip RTP header
unsigned char* ptrIn = (unsigned char*) &in_data[12];
unsigned char* ptrOut = (unsigned char*) &out_data[12];
// network byte order
for (i = 0; i < nBytesPayload; i++) {
// produce two output samples for each input sample
*ptrOut++ = *ptrIn; // left sample
*ptrOut++ = *ptrIn; // right sample
ptrIn++;
}
*bytes_out = 12 + 2 * nBytesPayload;
} else if (_extOnOff && (_extBitsPerSample == -1)) {
// stereo emulation (frame based)
const int nBytesPayload = bytes_in - 12;
// RTP header (first 12 bytes)
memcpy(out_data, in_data, 12);
// skip RTP header
unsigned char* ptrIn = (unsigned char*) &in_data[12];
unsigned char* ptrOut = (unsigned char*) &out_data[12];
// left channel
for (i = 0; i < nBytesPayload; i++) {
*ptrOut++ = *ptrIn++;
}
ptrIn = (unsigned char*) &in_data[12];
// right channel
for (i = 0; i < nBytesPayload; i++) {
*ptrOut++ = *ptrIn++;
}
*bytes_out = 12 + 2 * nBytesPayload;
}
}
void VoEUnitTest::decrypt(int channel_no, unsigned char * in_data,
unsigned char * out_data, int bytes_in,
int * bytes_out) {
int i;
for (i = 0; i < bytes_in; i++)
out_data[i] = in_data[i];
*bytes_out = bytes_in;
}
void VoEUnitTest::encrypt_rtcp(int channel_no, unsigned char * in_data,
unsigned char * out_data, int bytes_in,
int * bytes_out) {
int i;
for (i = 0; i < bytes_in; i++)
out_data[i] = in_data[i];
*bytes_out = bytes_in;
}
void VoEUnitTest::decrypt_rtcp(int channel_no, unsigned char * in_data,
unsigned char * out_data, int bytes_in,
int * bytes_out) {
int i;
for (i = 0; i < bytes_in; i++)
out_data[i] = in_data[i];
*bytes_out = bytes_in;
}
void VoEUnitTest::SetStereoExternalEncryption(int channel, bool onOff,
int bitsPerSample) {
int bitsPerSample) {
_extOnOff = onOff;
_extChannel = channel;
_extBitsPerSample = bitsPerSample;
@ -359,7 +248,6 @@ int VoEUnitTest::MixerTest() {
VoECodec* codec = _mgr.CodecPtr();
VoEFile* file = _mgr.FilePtr();
VoEVolumeControl* volume = _mgr.VolumeControlPtr();
VoEEncryption* encrypt = _mgr.EncryptionPtr();
VoEDtmf* dtmf = _mgr.DtmfPtr();
VoEExternalMedia* xmedia = _mgr.ExternalMediaPtr();
@ -554,10 +442,6 @@ int VoEUnitTest::MixerTest() {
Test(">> Verify correct mixing in stereo using emulated stereo input:\n");
// enable external encryption
CHECK(encrypt->RegisterExternalEncryption(0, *this));
Test("(ch 0) External Encryption is now enabled:");
Test("(ch 0) Sending file at 8kHz <=> mixing in mono @ 8kHz...");
CHECK(StartMedia(0, 12345, true, true, true, true, false));
Sleep(testTime);
@ -621,8 +505,6 @@ int VoEUnitTest::MixerTest() {
StopMedia(0);
l16_32.channels = 1;
// disable external encryption
CHECK(encrypt->DeRegisterExternalEncryption(0));
ANL();
base->DeleteChannel(0);
@ -988,10 +870,6 @@ int VoEUnitTest::MixerTest() {
Test(">> Verify emulated stereo encoding for differenct codecs:\n");
// enable external encryption
CHECK(encrypt->RegisterExternalEncryption(0, *this));
Test("(ch 0) External Encryption is now enabled:");
// register all codecs on the receiving side
strcpy(PCMU.plname, "PCMU");
PCMU.channels = 2;
@ -1068,9 +946,6 @@ int VoEUnitTest::MixerTest() {
StopMedia(0);
// disable external encryption
CHECK(encrypt->DeRegisterExternalEncryption(0));
base->DeleteChannel(0);
// ------------------------------------------------------------------------

View File

@ -19,23 +19,12 @@ namespace voetest {
class VoETestManager;
class VoEUnitTest : public Encryption {
class VoEUnitTest {
public:
VoEUnitTest(VoETestManager& mgr);
~VoEUnitTest() {}
int DoTest();
protected:
// Encryption
void encrypt(int channel_no, unsigned char * in_data,
unsigned char * out_data, int bytes_in, int * bytes_out);
void decrypt(int channel_no, unsigned char * in_data,
unsigned char * out_data, int bytes_in, int * bytes_out);
void encrypt_rtcp(int channel_no, unsigned char * in_data,
unsigned char * out_data, int bytes_in, int * bytes_out);
void decrypt_rtcp(int channel_no, unsigned char * in_data,
unsigned char * out_data, int bytes_in, int * bytes_out);
private:
int MenuSelection();
int MixerTest();

View File

@ -32,7 +32,6 @@
#include "webrtc/voice_engine/include/voe_base.h"
#include "webrtc/voice_engine/include/voe_codec.h"
#include "webrtc/voice_engine/include/voe_dtmf.h"
#include "webrtc/voice_engine/include/voe_encryption.h"
#include "webrtc/voice_engine/include/voe_errors.h"
#include "webrtc/voice_engine/include/voe_external_media.h"
#include "webrtc/voice_engine/include/voe_file.h"
@ -67,7 +66,6 @@ VoEAudioProcessing* apm = NULL;
VoENetwork* netw = NULL;
VoEFile* file = NULL;
VoEVideoSync* vsync = NULL;
VoEEncryption* encr = NULL;
VoEHardware* hardware = NULL;
VoEExternalMedia* xmedia = NULL;
VoENetEqStats* neteqst = NULL;
@ -147,7 +145,6 @@ int main(int argc, char** argv) {
netw = VoENetwork::GetInterface(m_voe);
file = VoEFile::GetInterface(m_voe);
vsync = VoEVideoSync::GetInterface(m_voe);
encr = VoEEncryption::GetInterface(m_voe);
hardware = VoEHardware::GetInterface(m_voe);
xmedia = VoEExternalMedia::GetInterface(m_voe);
neteqst = VoENetEqStats::GetInterface(m_voe);
@ -220,9 +217,6 @@ int main(int argc, char** argv) {
if (vsync)
vsync->Release();
if (encr)
encr->Release();
if (hardware)
hardware->Release();

View File

@ -274,72 +274,6 @@ void MediaProcessImpl::Process(int channel,
}
}
// ----------------------------------------------------------------------------
// Encryptionen
// ----------------------------------------------------------------------------
class MyEncryption : public Encryption
{
public:
void encrypt(int channel_no, unsigned char * in_data, unsigned char * out_data, int bytes_in, int* bytes_out);
void decrypt(int channel_no, unsigned char * in_data, unsigned char * out_data, int bytes_in, int* bytes_out);
void encrypt_rtcp(int channel_no, unsigned char * in_data, unsigned char * out_data, int bytes_in, int* bytes_out);
void decrypt_rtcp(int channel_no, unsigned char * in_data, unsigned char * out_data, int bytes_in, int* bytes_out);
};
void MyEncryption::encrypt(int channel_no, unsigned char * in_data, unsigned char * out_data, int bytes_in, int* bytes_out)
{
// --- Stereo emulation (sample based, 2 bytes per sample)
const int nBytesPayload = bytes_in-12;
// RTP header (first 12 bytes)
memcpy(out_data, in_data, 12);
// skip RTP header
short* ptrIn = (short*) &in_data[12];
short* ptrOut = (short*) &out_data[12];
// network byte order
for (int i = 0; i < nBytesPayload/2; i++)
{
// produce two output samples for each input sample
*ptrOut++ = *ptrIn; // left sample
*ptrOut++ = *ptrIn; // right sample
ptrIn++;
}
*bytes_out = 12 + 2*nBytesPayload;
/*
for(int i = 0; i < bytes_in; i++)
out_data[i] =~ in_data[i];
*bytes_out = bytes_in;
*/
}
void MyEncryption::decrypt(int channel_no, unsigned char * in_data, unsigned char * out_data, int bytes_in, int* bytes_out)
{
// Do nothing (<=> memcpy)
for(int i = 0; i < bytes_in; i++)
out_data[i] = in_data[i];
*bytes_out = bytes_in;
}
void MyEncryption::encrypt_rtcp(int channel_no, unsigned char * in_data, unsigned char * out_data, int bytes_in, int* bytes_out)
{
for(int i = 0; i < bytes_in; i++)
out_data[i] =~ in_data[i];
*bytes_out = bytes_in;
}
void MyEncryption::decrypt_rtcp(int channel_no, unsigned char * in_data, unsigned char * out_data, int bytes_in, int* bytes_out)
{
for(int i = 0; i < bytes_in; i++)
out_data[i] =~ in_data[i];
*bytes_out = bytes_in;
}
// ----------------------------------------------------------------------------
// TelephoneEventObserver
// ----------------------------------------------------------------------------
@ -1121,10 +1055,8 @@ CWinTestDlg::CWinTestDlg(CWnd* pParent /*=NULL*/)
_veHardwarePtr(NULL),
_veExternalMediaPtr(NULL),
_veApmPtr(NULL),
_veEncryptionPtr(NULL),
_veRtpRtcpPtr(NULL),
_transportPtr(NULL),
_encryptionPtr(NULL),
_externalMediaPtr(NULL),
_externalTransport(false),
_externalTransportBuild(false),
@ -1172,7 +1104,6 @@ CWinTestDlg::CWinTestDlg(CWnd* pParent /*=NULL*/)
{
_veExternalMediaPtr = VoEExternalMedia::GetInterface(_vePtr);
_veVolumeControlPtr = VoEVolumeControl::GetInterface(_vePtr);
_veEncryptionPtr = VoEEncryption::GetInterface(_vePtr);
_veVideoSyncPtr = VoEVideoSync::GetInterface(_vePtr);
_veNetworkPtr = VoENetwork::GetInterface(_vePtr);
_veFilePtr = VoEFile::GetInterface(_vePtr);
@ -1183,7 +1114,6 @@ CWinTestDlg::CWinTestDlg(CWnd* pParent /*=NULL*/)
_veHardwarePtr = VoEHardware::GetInterface(_vePtr);
_veRtpRtcpPtr = VoERTP_RTCP::GetInterface(_vePtr);
_transportPtr = new MyTransport(_veNetworkPtr);
_encryptionPtr = new MyEncryption();
_externalMediaPtr = new MediaProcessImpl();
_connectionObserverPtr = new ConnectionObserver();
_rxVadObserverPtr = new RxCallback();
@ -1204,11 +1134,9 @@ CWinTestDlg::~CWinTestDlg()
if (_connectionObserverPtr) delete _connectionObserverPtr;
if (_externalMediaPtr) delete _externalMediaPtr;
if (_transportPtr) delete _transportPtr;
if (_encryptionPtr) delete _encryptionPtr;
if (_rxVadObserverPtr) delete _rxVadObserverPtr;
if (_veExternalMediaPtr) _veExternalMediaPtr->Release();
if (_veEncryptionPtr) _veEncryptionPtr->Release();
if (_veVideoSyncPtr) _veVideoSyncPtr->Release();
if (_veVolumeControlPtr) _veVolumeControlPtr->Release();
@ -2675,162 +2603,32 @@ void CWinTestDlg::OnBnClickedCheckMuteIn2()
void CWinTestDlg::OnBnClickedCheckSrtpTx1()
{
int ret(0);
int channel = GetDlgItemInt(IDC_EDIT_1);
CButton* button = (CButton*)GetDlgItem(IDC_CHECK_SRTP_TX_1);
int check = button->GetCheck();
const bool enable = (check == BST_CHECKED);
bool useForRTCP = false;
if (enable)
{
(_checkSrtpTx1++ %2 == 0) ? useForRTCP = false : useForRTCP = true;
// TODO(solenberg): Install SRTP encryption policy.
TEST(true, "Built-in SRTP support is deprecated. Enable it again by "
"setting an external encryption policy, i.e.:\n\r"
"_veEncryptionPtr->RegisterExternalEncryption(channel, myPolicy)");
}
else
{
// TODO(solenberg): Uninstall SRTP encryption policy, i.e.:
// _veEncryptionPtr->DeRegisterExternalEncryption(channel);
}
if (ret == -1)
{
// restore inital state since API call failed
button->SetCheck((check == BST_CHECKED) ? BST_UNCHECKED : BST_CHECKED);
}
TEST(true, "Built-in SRTP support is deprecated.");
}
void CWinTestDlg::OnBnClickedCheckSrtpTx2()
{
int ret(0);
int channel = GetDlgItemInt(IDC_EDIT_2);
CButton* button = (CButton*)GetDlgItem(IDC_CHECK_SRTP_TX_2);
int check = button->GetCheck();
const bool enable = (check == BST_CHECKED);
bool useForRTCP = false;
if (enable)
{
(_checkSrtpTx2++ %2 == 0) ? useForRTCP = false : useForRTCP = true;
// TODO(solenberg): Install SRTP encryption policy.
TEST(true, "Built-in SRTP support is deprecated. Enable it again by "
"setting an external encryption policy, i.e.:\n\r"
"_veEncryptionPtr->RegisterExternalEncryption(channel, myPolicy)");
}
else
{
// TODO(solenberg): Uninstall SRTP encryption policy, i.e.:
// _veEncryptionPtr->DeRegisterExternalEncryption(channel);
}
if (ret == -1)
{
// restore inital state since API call failed
button->SetCheck((check == BST_CHECKED) ? BST_UNCHECKED : BST_CHECKED);
}
TEST(true, "Built-in SRTP support is deprecated.");
}
void CWinTestDlg::OnBnClickedCheckSrtpRx1()
{
int ret(0);
int channel = GetDlgItemInt(IDC_EDIT_1);
CButton* button = (CButton*)GetDlgItem(IDC_CHECK_SRTP_RX_1);
int check = button->GetCheck();
const bool enable = (check == BST_CHECKED);
bool useForRTCP(false);
if (enable)
{
(_checkSrtpRx1++ %2 == 0) ? useForRTCP = false : useForRTCP = true;
// TODO(solenberg): Install SRTP encryption policy.
TEST(true, "Built-in SRTP support is deprecated. Enable it again by "
"setting an external encryption policy, i.e.:\n\r"
"_veEncryptionPtr->RegisterExternalEncryption(channel, myPolicy)");
}
else
{
// TODO(solenberg): Uninstall SRTP encryption policy, i.e.:
// _veEncryptionPtr->DeRegisterExternalEncryption(channel);
}
if (ret == -1)
{
// restore inital state since API call failed
button->SetCheck((check == BST_CHECKED) ? BST_UNCHECKED : BST_CHECKED);
}
TEST(true, "Built-in SRTP support is deprecated.");
}
void CWinTestDlg::OnBnClickedCheckSrtpRx2()
{
int ret(0);
int channel = GetDlgItemInt(IDC_EDIT_2);
CButton* button = (CButton*)GetDlgItem(IDC_CHECK_SRTP_RX_2);
int check = button->GetCheck();
const bool enable = (check == BST_CHECKED);
bool useForRTCP(false);
if (enable)
{
(_checkSrtpRx2++ %2 == 0) ? useForRTCP = false : useForRTCP = true;
// TODO(solenberg): Install SRTP encryption policy.
TEST(true, "Built-in SRTP support is deprecated. Enable it again by "
"setting an external encryption policy, i.e.:\n\r"
"_veEncryptionPtr->RegisterExternalEncryption(channel, myPolicy)");
}
else
{
// TODO(solenberg): Uninstall SRTP encryption policy, i.e.:
// _veEncryptionPtr->DeRegisterExternalEncryption(channel);
}
if (ret == -1)
{
// restore inital state since API call failed
button->SetCheck((check == BST_CHECKED) ? BST_UNCHECKED : BST_CHECKED);
}
TEST(true, "Built-in SRTP support is deprecated.");
}
void CWinTestDlg::OnBnClickedCheckExtEncryption1()
{
int ret(0);
int channel = GetDlgItemInt(IDC_EDIT_1);
CButton* button = (CButton*)GetDlgItem(IDC_CHECK_EXT_ENCRYPTION_1);
int check = button->GetCheck();
const bool enable = (check == BST_CHECKED);
if (enable)
{
TEST((ret = _veEncryptionPtr->RegisterExternalEncryption(channel, *_encryptionPtr)) == 0,
_T("RegisterExternalEncryption(channel=%d, encryption=0x%x)"), channel, _encryptionPtr);
}
else
{
TEST((ret = _veEncryptionPtr->DeRegisterExternalEncryption(channel)) == 0,
_T("DeRegisterExternalEncryption(channel=%d)"), channel);
}
if (ret == -1)
{
// restore inital state since API call failed
button->SetCheck((check == BST_CHECKED) ? BST_UNCHECKED : BST_CHECKED);
}
TEST(true, "External Encryption has been removed from the API!");
}
void CWinTestDlg::OnBnClickedCheckExtEncryption2()
{
int ret(0);
int channel = GetDlgItemInt(IDC_EDIT_2);
CButton* button = (CButton*)GetDlgItem(IDC_CHECK_EXT_ENCRYPTION_2);
int check = button->GetCheck();
const bool enable = (check == BST_CHECKED);
if (enable)
{
TEST((ret = _veEncryptionPtr->RegisterExternalEncryption(channel, *_encryptionPtr)) == 0,
_T("RegisterExternalEncryption(channel=%d, encryption=0x%x)"), channel, _encryptionPtr);
}
else
{
TEST((ret = _veEncryptionPtr->DeRegisterExternalEncryption(channel)) == 0,
_T("DeRegisterExternalEncryption(channel=%d)"), channel);
}
if (ret == -1)
{
// restore inital state since API call failed
button->SetCheck((check == BST_CHECKED) ? BST_UNCHECKED : BST_CHECKED);
}
TEST(true, "External Encryption has been removed from the API!");
}
void CWinTestDlg::OnBnClickedButtonDtmf1()

View File

@ -83,7 +83,6 @@
#include "webrtc/voice_engine/include/voe_base.h"
#include "webrtc/voice_engine/include/voe_codec.h"
#include "webrtc/voice_engine/include/voe_dtmf.h"
#include "webrtc/voice_engine/include/voe_encryption.h"
#include "webrtc/voice_engine/include/voe_external_media.h"
#include "webrtc/voice_engine/include/voe_file.h"
#include "webrtc/voice_engine/include/voe_hardware.h"
@ -98,7 +97,6 @@
class MediaProcessImpl;
class ConnectionObserver;
class MyEncryption;
class RxCallback;
class MyTransport;
@ -153,7 +151,6 @@ private:
VoECodec* _veCodecPtr;
VoEExternalMedia* _veExternalMediaPtr;
VoEVolumeControl* _veVolumeControlPtr;
VoEEncryption* _veEncryptionPtr;
VoEHardware* _veHardwarePtr;
VoEVideoSync* _veVideoSyncPtr;
VoENetwork* _veNetworkPtr;
@ -165,7 +162,6 @@ private:
MyTransport* _transportPtr;
MediaProcessImpl* _externalMediaPtr;
ConnectionObserver* _connectionObserverPtr;
MyEncryption* _encryptionPtr;
RxCallback* _rxVadObserverPtr;
private:
@ -252,8 +248,6 @@ public:
afx_msg void OnBnClickedCheckSrtpRx1();
afx_msg void OnBnClickedCheckSrtpTx2();
afx_msg void OnBnClickedCheckSrtpRx2();
afx_msg void OnBnClickedCheckExtEncryption1();
afx_msg void OnBnClickedCheckExtEncryption2();
afx_msg void OnBnClickedButtonDtmf1();
afx_msg void OnBnClickedCheckRecMic();
afx_msg void OnBnClickedButtonDtmf2();

View File

@ -1,96 +0,0 @@
/*
* Copyright (c) 2012 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.
*/
#include "webrtc/voice_engine/voe_encryption_impl.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/trace.h"
#include "webrtc/voice_engine/channel.h"
#include "webrtc/voice_engine/include/voe_errors.h"
#include "webrtc/voice_engine/voice_engine_impl.h"
namespace webrtc {
VoEEncryption* VoEEncryption::GetInterface(VoiceEngine* voiceEngine)
{
#ifndef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
return NULL;
#else
if (NULL == voiceEngine)
{
return NULL;
}
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
s->AddRef();
return s;
#endif
}
#ifdef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
VoEEncryptionImpl::VoEEncryptionImpl(voe::SharedData* shared) : _shared(shared)
{
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
"VoEEncryptionImpl::VoEEncryptionImpl() - ctor");
}
VoEEncryptionImpl::~VoEEncryptionImpl()
{
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
"VoEEncryptionImpl::~VoEEncryptionImpl() - dtor");
}
int VoEEncryptionImpl::RegisterExternalEncryption(int channel,
Encryption& encryption)
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"RegisterExternalEncryption(channel=%d, encryption=0x%x)",
channel, &encryption);
if (!_shared->statistics().Initialized())
{
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"RegisterExternalEncryption() failed to locate channel");
return -1;
}
return channelPtr->RegisterExternalEncryption(encryption);
}
int VoEEncryptionImpl::DeRegisterExternalEncryption(int channel)
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"DeRegisterExternalEncryption(channel=%d)", channel);
if (!_shared->statistics().Initialized())
{
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"DeRegisterExternalEncryption() failed to locate channel");
return -1;
}
return channelPtr->DeRegisterExternalEncryption();
}
#endif // #ifdef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
// EOF
} // namespace webrtc

View File

@ -1,40 +0,0 @@
/*
* Copyright (c) 2012 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 WEBRTC_VOICE_ENGINE_VOE_ENCRYPTION_IMPL_H
#define WEBRTC_VOICE_ENGINE_VOE_ENCRYPTION_IMPL_H
#include "webrtc/voice_engine/include/voe_encryption.h"
#include "webrtc/voice_engine/shared_data.h"
namespace webrtc {
class VoEEncryptionImpl : public VoEEncryption
{
public:
// External encryption
virtual int RegisterExternalEncryption(
int channel,
Encryption& encryption);
virtual int DeRegisterExternalEncryption(int channel);
protected:
VoEEncryptionImpl(voe::SharedData* shared);
virtual ~VoEEncryptionImpl();
private:
voe::SharedData* _shared;
};
} // namespace webrtc
#endif // #ifndef WEBRTC_VOICE_ENGINE_VOE_ENCRYPTION_IMPL_H

View File

@ -34,7 +34,6 @@
'include/voe_call_report.h',
'include/voe_codec.h',
'include/voe_dtmf.h',
'include/voe_encryption.h',
'include/voe_errors.h',
'include/voe_external_media.h',
'include/voe_file.h',
@ -78,8 +77,6 @@
'voe_codec_impl.h',
'voe_dtmf_impl.cc',
'voe_dtmf_impl.h',
'voe_encryption_impl.cc',
'voe_encryption_impl.h',
'voe_external_media_impl.cc',
'voe_external_media_impl.h',
'voe_file_impl.cc',
@ -155,7 +152,6 @@
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
'<(webrtc_root)/test/libtest/libtest.gyp:libtest',
'<(webrtc_root)/test/test.gyp:channel_transport',
'<(webrtc_root)/test/test.gyp:test_support',
],
@ -171,13 +167,11 @@
'test/auto_test/fixtures/after_streaming_fixture.h',
'test/auto_test/fixtures/before_initialization_fixture.cc',
'test/auto_test/fixtures/before_initialization_fixture.h',
'test/auto_test/fuzz/rtp_fuzz_test.cc',
'test/auto_test/standard/audio_processing_test.cc',
'test/auto_test/standard/call_report_test.cc',
'test/auto_test/standard/codec_before_streaming_test.cc',
'test/auto_test/standard/codec_test.cc',
'test/auto_test/standard/dtmf_test.cc',
'test/auto_test/standard/encryption_test.cc',
'test/auto_test/standard/external_media_test.cc',
'test/auto_test/standard/file_before_streaming_test.cc',
'test/auto_test/standard/file_test.cc',

View File

@ -27,9 +27,6 @@
#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
#include "webrtc/voice_engine/voe_dtmf_impl.h"
#endif
#ifdef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
#include "webrtc/voice_engine/voe_encryption_impl.h"
#endif
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
#include "webrtc/voice_engine/voe_external_media_impl.h"
#endif
@ -70,9 +67,6 @@ class VoiceEngineImpl : public voe::SharedData, // Must be the first base class
#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
public VoEDtmfImpl,
#endif
#ifdef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
public VoEEncryptionImpl,
#endif
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
public VoEExternalMediaImpl,
#endif
@ -112,9 +106,6 @@ public:
#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
VoEDtmfImpl(this),
#endif
#ifdef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
VoEEncryptionImpl(this),
#endif
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
VoEExternalMediaImpl(this),
#endif