Make VoiceEngineImpl inherit from VoiceEngine.
This associates the two types instead of incorrectly reinterpret casting VoiceEngineImpl* to VoiceEngine* (since these types were previously unrelated). Please see more details in the bug for how this is currently causing problems with security tools. BUG=38612 Review URL: https://webrtc-codereview.appspot.com/1099013 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3520 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
17238576ba
commit
0989fb7bfa
@ -86,7 +86,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
VoiceEngine() {}
|
VoiceEngine() {}
|
||||||
virtual ~VoiceEngine() {}
|
~VoiceEngine() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// VoEBase
|
// VoEBase
|
||||||
|
@ -51,7 +51,7 @@ VoEAudioProcessing* VoEAudioProcessing::GetInterface(VoiceEngine* voiceEngine) {
|
|||||||
if (NULL == voiceEngine) {
|
if (NULL == voiceEngine) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,7 +40,7 @@ VoEBase* VoEBase::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ VoECallReport* VoECallReport::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,7 +29,7 @@ VoECodec* VoECodec::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,7 +29,7 @@ VoEDtmf* VoEDtmf::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,7 @@ VoEEncryption* VoEEncryption::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,7 +29,7 @@ VoEExternalMedia* VoEExternalMedia::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,7 +31,7 @@ VoEFile* VoEFile::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,7 +30,7 @@ VoEHardware* VoEHardware::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,7 +29,7 @@ VoENetEqStats* VoENetEqStats::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,7 @@ VoENetwork* VoENetwork::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,7 +29,7 @@ VoERTP_RTCP* VoERTP_RTCP::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,7 +27,7 @@ VoEVideoSync* VoEVideoSync::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,7 +29,7 @@ VoEVolumeControl* VoEVolumeControl::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
s->AddRef();
|
s->AddRef();
|
||||||
return s;
|
return s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,13 +31,12 @@ WEBRTC_DLLEXPORT VoiceEngine* GetVoiceEngine();
|
|||||||
VoiceEngine* GetVoiceEngine()
|
VoiceEngine* GetVoiceEngine()
|
||||||
{
|
{
|
||||||
VoiceEngineImpl* self = new VoiceEngineImpl();
|
VoiceEngineImpl* self = new VoiceEngineImpl();
|
||||||
VoiceEngine* ve = reinterpret_cast<VoiceEngine*>(self);
|
if (self != NULL)
|
||||||
if (ve != NULL)
|
|
||||||
{
|
{
|
||||||
self->AddRef(); // First reference. Released in VoiceEngine::Delete.
|
self->AddRef(); // First reference. Released in VoiceEngine::Delete.
|
||||||
gVoiceEngineInstanceCounter++;
|
gVoiceEngineInstanceCounter++;
|
||||||
}
|
}
|
||||||
return ve;
|
return self;
|
||||||
}
|
}
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
@ -128,7 +127,7 @@ bool VoiceEngine::Delete(VoiceEngine*& voiceEngine)
|
|||||||
if (voiceEngine == NULL)
|
if (voiceEngine == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
// Release the reference that was added in GetVoiceEngine.
|
// Release the reference that was added in GetVoiceEngine.
|
||||||
int ref = s->Release();
|
int ref = s->Release();
|
||||||
voiceEngine = NULL;
|
voiceEngine = NULL;
|
||||||
|
@ -59,6 +59,7 @@ namespace webrtc
|
|||||||
{
|
{
|
||||||
|
|
||||||
class VoiceEngineImpl : public voe::SharedData, // Must be the first base class
|
class VoiceEngineImpl : public voe::SharedData, // Must be the first base class
|
||||||
|
public VoiceEngine,
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
|
#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
|
||||||
public VoEAudioProcessingImpl,
|
public VoEAudioProcessingImpl,
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user