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

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

Issue 2326003002: Moved codec-specific audio packet splitting into decoders. (Closed)
Patch Set: Fixed types in packet splitting (size_t vs. uint32_t) 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/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..93b24bdf2c718405fbbbab56fea7c4d8cada2473 100644
--- a/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc
+++ b/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc
@@ -13,6 +13,7 @@
#include <string.h>
#include "webrtc/base/checks.h"
+#include "webrtc/modules/audio_coding/codecs/legacy_encoded_audio_frame.h"
#include "webrtc/modules/audio_coding/codecs/g722/g722_interface.h"
namespace webrtc {
@@ -47,6 +48,14 @@ void AudioDecoderG722::Reset() {
WebRtcG722_DecoderInit(dec_state_);
}
+std::vector<AudioDecoder::ParseResult> AudioDecoderG722::ParsePayload(
+ rtc::Buffer&& payload,
+ uint32_t timestamp,
+ bool is_primary) {
+ return LegacyEncodedAudioFrame::SplitBySamples(this, std::move(payload),
+ timestamp, is_primary, 8, 16);
+}
+
int AudioDecoderG722::PacketDuration(const uint8_t* encoded,
size_t encoded_len) const {
// 1/2 encoded byte per sample per channel.
@@ -117,6 +126,14 @@ void AudioDecoderG722Stereo::Reset() {
WebRtcG722_DecoderInit(dec_state_right_);
}
+std::vector<AudioDecoder::ParseResult> AudioDecoderG722Stereo::ParsePayload(
+ rtc::Buffer&& payload,
+ uint32_t timestamp,
+ bool is_primary) {
+ return LegacyEncodedAudioFrame::SplitBySamples(
+ this, std::move(payload), timestamp, is_primary, 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,
« no previous file with comments | « webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h ('k') | webrtc/modules/audio_coding/codecs/g722/g722.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698