Reland r8248 "Introduce ACMGenericCodecWrapper"
This effectively reverts r8249.
This new class inherits from ACMGenericCodec. The purpose is to wrap
AudioEncoder objects into an ACMGenericCodec interface. This is a
temporary construction that will be used during the ACM redesign work.
BUG=4228
COAUTHOR=kwiberg@webrtc.org
TBR=tina.legrand@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/38919004
Cr-Commit-Position: refs/heads/master@{#8255}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8255 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/codecs/audio_encoder.cc b/webrtc/modules/audio_coding/codecs/audio_encoder.cc
index 20e5953..ae1bce1 100644
--- a/webrtc/modules/audio_coding/codecs/audio_encoder.cc
+++ b/webrtc/modules/audio_coding/codecs/audio_encoder.cc
@@ -9,6 +9,7 @@
*/
#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
+#include "webrtc/base/checks.h"
namespace webrtc {
@@ -18,6 +19,20 @@
AudioEncoder::EncodedInfo::~EncodedInfo() {
}
+bool AudioEncoder::Encode(uint32_t rtp_timestamp,
+ const int16_t* audio,
+ size_t num_samples_per_channel,
+ size_t max_encoded_bytes,
+ uint8_t* encoded,
+ EncodedInfo* info) {
+ CHECK_EQ(num_samples_per_channel,
+ static_cast<size_t>(sample_rate_hz() / 100));
+ bool ret =
+ EncodeInternal(rtp_timestamp, audio, max_encoded_bytes, encoded, info);
+ CHECK_LE(info->encoded_bytes, max_encoded_bytes);
+ return ret;
+}
+
int AudioEncoder::rtp_timestamp_rate_hz() const {
return sample_rate_hz();
}
diff --git a/webrtc/modules/audio_coding/codecs/audio_encoder.h b/webrtc/modules/audio_coding/codecs/audio_encoder.h
index 9b0c11b..6fc5827 100644
--- a/webrtc/modules/audio_coding/codecs/audio_encoder.h
+++ b/webrtc/modules/audio_coding/codecs/audio_encoder.h
@@ -14,7 +14,6 @@
#include <algorithm>
#include <vector>
-#include "webrtc/base/checks.h"
#include "webrtc/typedefs.h"
namespace webrtc {
@@ -63,14 +62,7 @@
size_t num_samples_per_channel,
size_t max_encoded_bytes,
uint8_t* encoded,
- EncodedInfo* info) {
- CHECK_EQ(num_samples_per_channel,
- static_cast<size_t>(sample_rate_hz() / 100));
- bool ret =
- EncodeInternal(rtp_timestamp, audio, max_encoded_bytes, encoded, info);
- CHECK_LE(info->encoded_bytes, max_encoded_bytes);
- return ret;
- }
+ EncodedInfo* info);
// Return the input sample rate in Hz and the number of input channels.
// These are constants set at instantiation time.
diff --git a/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc b/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc
index 5b072e4..c2f6424 100644
--- a/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc
+++ b/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc
@@ -12,6 +12,7 @@
#include <limits>
+#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h b/webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h
index 4982e5a..2727611 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h
@@ -11,6 +11,7 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_AUDIO_ENCODER_ISACFIX_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INTERFACE_AUDIO_ENCODER_ISACFIX_H_
+#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h"
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h b/webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h
index 41ed490..4ab88b6 100644
--- a/webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h
+++ b/webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h
@@ -11,6 +11,7 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_ENCODER_ISAC_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_AUDIO_ENCODER_ISAC_H_
+#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h"
#include "webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h"
diff --git a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc
index c3d5601..2b0fb91 100644
--- a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc
+++ b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc
@@ -12,6 +12,8 @@
#include <string.h>
+#include "webrtc/base/checks.h"
+
namespace webrtc {
AudioEncoderCopyRed::AudioEncoderCopyRed(const Config& config)
diff --git a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc
index 35a8b2f..de1339d 100644
--- a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc
+++ b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc
@@ -9,6 +9,7 @@
*/
#include "testing/gtest/include/gtest/gtest.h"
+#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h"
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"