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

Unified Diff: webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc

Issue 2342443005: Moved Opus-specific payload splitting into AudioDecoderOpus. (Closed)
Patch Set: Created 4 years, 3 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_coding/neteq/neteq_network_stats_unittest.cc
diff --git a/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
index 15c60a83b5dedf5f3a44210a702580479e23a3c7..b2a5433fab81e6bdfb232cbd52a721c62df22f5c 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
@@ -39,18 +39,49 @@ class MockAudioDecoder final : public AudioDecoder {
MOCK_METHOD0(Reset, void());
- int PacketDuration(const uint8_t* encoded,
- size_t encoded_len) const /* override */ {
- return kPacketDuration;
+ class MockFrame : public AudioDecoder::EncodedAudioFrame {
+ public:
+ MockFrame(size_t num_channels) : num_channels_(num_channels) {}
+
+ size_t Duration() const /* override */ { return kPacketDuration; }
kwiberg-webrtc 2016/09/19 11:07:49 Do you need to comment out the overrides when you'
ossu 2016/09/19 11:41:01 No, I don't think I should have to. Wonder why the
kwiberg-webrtc 2016/09/19 11:55:16 Because MOCK_METHOD0 et al. expand to method decla
ossu 2016/09/19 14:07:34 Oh, right, now I see. I forgot why I left them in.
+
+ rtc::Optional<DecodeResult> Decode(rtc::ArrayView<int16_t> decoded) const
+ /* override */ {
+ memset(decoded.data(), 0,
hlundin-webrtc 2016/09/15 09:33:30 ASSERT_GE(decoded.size(), sizeof(int16_t) * kPacke
ossu 2016/09/15 12:22:53 Acknowledged.
+ sizeof(int16_t) * kPacketDuration * num_channels_);
+ return rtc::Optional<DecodeResult>(
+ {kPacketDuration * num_channels_, kSpeech});
+ }
+
+ private:
+ size_t num_channels_;
hlundin-webrtc 2016/09/15 09:33:30 const
ossu 2016/09/15 12:22:53 Acknowledged.
+ };
+
+ std::vector<ParseResult> ParsePayload(rtc::Buffer* payload,
+ uint32_t timestamp) /* override */ {
+ std::vector<ParseResult> results;
+ if (fec_enabled_) {
+ std::unique_ptr<MockFrame> fec_frame(new MockFrame(num_channels_));
+ results.emplace_back(timestamp - kPacketDuration, 1,
+ std::move(fec_frame));
+ }
+
+ std::unique_ptr<MockFrame> frame(new MockFrame(num_channels_));
+ results.emplace_back(timestamp, 0, std::move(frame));
+ return results;
}
- int PacketDurationRedundant(const uint8_t* encoded,
- size_t encoded_len) const /* override */ {
+ int PacketDuration(const uint8_t* encoded, size_t encoded_len) const
+ /* override */ {
+ // Since going through ParsePayload, PacketDuration should never get called.
+ RTC_DCHECK(false);
return kPacketDuration;
}
bool PacketHasFec(
const uint8_t* encoded, size_t encoded_len) const /* override */ {
+ // Since going through ParsePayload, PacketHasFec should never get called.
+ RTC_DCHECK(false);
hlundin-webrtc 2016/09/15 09:33:30 FAIL();
ossu 2016/09/15 12:22:53 Acknowledged.
return fec_enabled_;
}
@@ -69,18 +100,8 @@ class MockAudioDecoder final : public AudioDecoder {
int /*sample_rate_hz*/,
int16_t* decoded,
SpeechType* speech_type) /* override */ {
- *speech_type = kSpeech;
- memset(decoded, 0, sizeof(int16_t) * kPacketDuration * Channels());
- return kPacketDuration * Channels();
- }
-
- int DecodeRedundantInternal(const uint8_t* encoded,
- size_t encoded_len,
- int sample_rate_hz,
- int16_t* decoded,
- SpeechType* speech_type) /* override */ {
- return DecodeInternal(encoded, encoded_len, sample_rate_hz, decoded,
- speech_type);
+ // Since going through ParsePayload, DecodeInternal should never get called.
+ RTC_DCHECK(false);
hlundin-webrtc 2016/09/15 09:33:30 FAIL();
ossu 2016/09/15 12:22:53 Acknowledged.
}
private:

Powered by Google App Engine
This is Rietveld 408576698