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

Unified Diff: webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc

Issue 2281453002: Moved codec-specific audio packet splitting into decoders. (Closed)
Patch Set: Created 4 years, 4 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/g722/audio_decoder_g722.cc
diff --git a/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc b/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc
index 379293b748b043985488e180934c2dd5c9baf060..9956d793d682065504a9928009b62243de592c67 100644
--- a/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc
+++ b/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc
@@ -47,6 +47,12 @@ void AudioDecoderG722::Reset() {
WebRtcG722_DecoderInit(dec_state_);
}
+AudioDecoder::PacketSplits AudioDecoderG722::SplitPacket(
+ const uint8_t* payload,
+ size_t payload_len) const {
+ return SplitBySamples(payload, payload_len, 8, 16);
kwiberg-webrtc 2016/08/26 12:39:24 You could probably make the SplitBySamples calls e
+}
+
int AudioDecoderG722::PacketDuration(const uint8_t* encoded,
size_t encoded_len) const {
// 1/2 encoded byte per sample per channel.
@@ -117,6 +123,17 @@ void AudioDecoderG722Stereo::Reset() {
WebRtcG722_DecoderInit(dec_state_right_);
}
+AudioDecoder::PacketSplits AudioDecoderG722Stereo::SplitPacket(
+ const uint8_t* payload,
+ size_t payload_len) const {
+ // TODO(ossu): There didn't seem to be splitting in place for this before, but
+ // from looking at the code, it seems this should work: the two
+ // channels are interleaved (since they need to be explicitly
+ // deinterleaved before decoding) so regular splitting should be
+ // fine.
kwiberg-webrtc 2016/08/26 12:39:24 I agree. (And I don't think this comment needs to
ossu 2016/08/26 13:05:30 Cool. I've put this TODO here so that it doesn't g
+ return SplitBySamples(payload, payload_len, 2 * 8, 16);
+}
+
// Split the stereo packet and place left and right channel after each other
// in the output array.
void AudioDecoderG722Stereo::SplitStereoPacket(const uint8_t* encoded,

Powered by Google App Engine
This is Rietveld 408576698