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

Unified Diff: remoting/codec/audio_decoder_verbatim.cc

Issue 10827324: Changed AudioPacket data to a repeated field. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 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: remoting/codec/audio_decoder_verbatim.cc
diff --git a/remoting/codec/audio_decoder_verbatim.cc b/remoting/codec/audio_decoder_verbatim.cc
index 8a69705e5d7bb160a64eab69638ac3125862647e..5892f480a8162be02186863431d2651a0f50309b 100644
--- a/remoting/codec/audio_decoder_verbatim.cc
+++ b/remoting/codec/audio_decoder_verbatim.cc
@@ -17,7 +17,13 @@ AudioDecoderVerbatim::~AudioDecoderVerbatim() {
scoped_ptr<AudioPacket> AudioDecoderVerbatim::Decode(
scoped_ptr<AudioPacket> packet) {
- DCHECK_EQ(AudioPacket::ENCODING_RAW, packet->encoding());
+ // Return a null scoped_ptr if we get a corrupted packet.
+ if ((packet->encoding() != AudioPacket::ENCODING_RAW) ||
+ (packet->data_size() != 1) ||
+ (packet->sampling_rate() == AudioPacket::SAMPLING_RATE_INVALID) ||
Sergey Ulanov 2012/08/15 00:47:20 do we require sampling_rate field to be present in
kxing 2012/08/15 16:00:05 Yes, currently we require sampling rate to be pres
+ (packet->bytes_per_sample() == AudioPacket::BYTES_PER_SAMPLE_INVALID)) {
+ return scoped_ptr<AudioPacket>(NULL);
Sergey Ulanov 2012/08/15 00:47:20 nit: drop NULL, just scoped_ptr<AudioPacket>()
kxing 2012/08/15 16:00:05 Done.
+ }
return packet.Pass();
}

Powered by Google App Engine
This is Rietveld 408576698