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

Unified Diff: webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.cc

Issue 2326003002: Moved codec-specific audio packet splitting into decoders. (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/codecs/pcm16b/audio_decoder_pcm16b.cc
diff --git a/webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.cc b/webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.cc
index dce5f4c516ae91bd723614a4050ac7ef2ffe98c4..b43b9dd7c769e7c47c9ae63bd7d287a0e86930cd 100644
--- a/webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.cc
+++ b/webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.cc
@@ -11,6 +11,7 @@
#include "webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.h"
#include "webrtc/base/checks.h"
+#include "webrtc/modules/audio_coding/codecs/split_by_samples.h"
#include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
namespace webrtc {
@@ -44,6 +45,16 @@ int AudioDecoderPcm16B::DecodeInternal(const uint8_t* encoded,
return static_cast<int>(ret);
}
+std::vector<AudioDecoder::PacketSplit> AudioDecoderPcm16B::SplitPacket(
+ rtc::ArrayView<const uint8_t> payload) const {
+ // TODO(ossu): Investigate if we can ever get 44.1KHz audio here, in which
hlundin-webrtc 2016/09/09 12:52:52 Short answer: no. If codecs should be allowed to r
kwiberg-webrtc 2016/09/12 02:11:01 Also, space between the number and the unit. But I
ossu 2016/09/12 11:26:37 The comment is only here for this to get caught in
kwiberg-webrtc 2016/09/13 12:23:37 Well, if you didn't want pedantic complaints about
ossu 2016/09/13 14:25:55 Acknowledged.
hlundin-webrtc 2016/09/15 08:49:14 :)
+ // case rounding will break. Consider replacing with
+ // CheckedDivExact to catch that happening.
+ return internal::SplitBySamples(payload,
+ sample_rate_hz_ * 2 * num_channels_ / 1000,
+ sample_rate_hz_ / 1000);
+}
+
int AudioDecoderPcm16B::PacketDuration(const uint8_t* encoded,
size_t encoded_len) const {
// Two encoded byte per sample per channel.

Powered by Google App Engine
This is Rietveld 408576698