Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1682)

Unified Diff: webrtc/modules/audio_processing/aec/echo_cancellation.c

Issue 1175903002: audio_processing: Create now returns a pointer to the object (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed review comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/aec/echo_cancellation.c
diff --git a/webrtc/modules/audio_processing/aec/echo_cancellation.c b/webrtc/modules/audio_processing/aec/echo_cancellation.c
index 06d081d3ce886af3fc86d9b55606eb8cc783b966..ec16aaf1d3b543a5e133fbf153022cb817f0fb6e 100644
--- a/webrtc/modules/audio_processing/aec/echo_cancellation.c
+++ b/webrtc/modules/audio_processing/aec/echo_cancellation.c
@@ -118,28 +118,22 @@ static void ProcessExtended(Aec* self,
int16_t reported_delay_ms,
int32_t skew);
-int32_t WebRtcAec_Create(void** aecInst) {
- Aec* aecpc;
- if (aecInst == NULL) {
- return -1;
- }
+void* WebRtcAec_Create() {
+ Aec* aecpc = malloc(sizeof(Aec));
- aecpc = malloc(sizeof(Aec));
- *aecInst = aecpc;
- if (aecpc == NULL) {
- return -1;
+ if (!aecpc) {
+ return NULL;
}
- if (WebRtcAec_CreateAec(&aecpc->aec) == -1) {
+ aecpc->aec = WebRtcAec_CreateAec();
+ if (!aecpc->aec) {
WebRtcAec_Free(aecpc);
- aecpc = NULL;
- return -1;
+ return NULL;
}
-
- if (WebRtcAec_CreateResampler(&aecpc->resampler) == -1) {
+ aecpc->resampler = WebRtcAec_CreateResampler();
+ if (!aecpc->resampler) {
WebRtcAec_Free(aecpc);
- aecpc = NULL;
- return -1;
+ return NULL;
}
// Create far-end pre-buffer. The buffer size has to be large enough for
// largest possible drift compensation (kResamplerBufferSize) + "almost" an
@@ -148,8 +142,7 @@ int32_t WebRtcAec_Create(void** aecInst) {
WebRtc_CreateBuffer(PART_LEN2 + kResamplerBufferSize, sizeof(float));
if (!aecpc->far_pre_buf) {
WebRtcAec_Free(aecpc);
- aecpc = NULL;
- return -1;
+ return NULL;
}
aecpc->initFlag = 0;
@@ -168,7 +161,7 @@ int32_t WebRtcAec_Create(void** aecInst) {
}
#endif
- return 0;
+ return aecpc;
}
void WebRtcAec_Free(void* aecInst) {
« no previous file with comments | « webrtc/modules/audio_processing/aec/aec_resampler.c ('k') | webrtc/modules/audio_processing/aec/echo_cancellation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698