AudioDecoder: Replace Init() with Reset()

The Init() method was previously used to initialize and reset
decoders, and returned an error code. The new Reset() method is used
for reset only; the constructor is now responsible for fully
initializing the AudioDecoder.

Reset() doesn't return an error code; it turned out that none of the
functions it ended up calling could actually fail, so this CL removes
their error return codes as well.

R=henrik.lundin@webrtc.org

Review URL: https://codereview.webrtc.org/1319683002 .

Cr-Commit-Position: refs/heads/master@{#9798}
This commit is contained in:
Karl Wiberg
2015-08-27 15:22:11 +02:00
parent 1c3dd38cb8
commit 4376648df0
38 changed files with 105 additions and 208 deletions

View File

@ -444,10 +444,7 @@ TEST_F(NetEqImplTest, VerifyTimestampPropagation) {
return encoded_len;
}
virtual int Init() {
next_value_ = 1;
return 0;
}
void Reset() override { next_value_ = 1; }
size_t Channels() const override { return 1; }
@ -524,7 +521,7 @@ TEST_F(NetEqImplTest, ReorderedPacket) {
// Create a mock decoder object.
MockAudioDecoder mock_decoder;
EXPECT_CALL(mock_decoder, Init()).WillRepeatedly(Return(0));
EXPECT_CALL(mock_decoder, Reset()).WillRepeatedly(Return());
EXPECT_CALL(mock_decoder, Channels()).WillRepeatedly(Return(1));
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
.WillRepeatedly(Return(0));
@ -690,7 +687,7 @@ TEST_F(NetEqImplTest, CodecInternalCng) {
// Create a mock decoder object.
MockAudioDecoder mock_decoder;
EXPECT_CALL(mock_decoder, Init()).WillRepeatedly(Return(0));
EXPECT_CALL(mock_decoder, Reset()).WillRepeatedly(Return());
EXPECT_CALL(mock_decoder, Channels()).WillRepeatedly(Return(1));
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
.WillRepeatedly(Return(0));
@ -829,9 +826,7 @@ TEST_F(NetEqImplTest, UnsupportedDecoder) {
class MockAudioDecoder : public AudioDecoder {
public:
int Init() override {
return 0;
}
void Reset() override {}
MOCK_CONST_METHOD2(PacketDuration, int(const uint8_t*, size_t));
MOCK_METHOD5(DecodeInternal, int(const uint8_t*, size_t, int, int16_t*,
SpeechType*));