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

Unified Diff: remoting/client/plugin/pepper_audio_player.cc

Issue 10823420: Added more error checking for audio packets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « no previous file | remoting/codec/audio_decoder_verbatim.cc » ('j') | remoting/codec/audio_decoder_verbatim.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/plugin/pepper_audio_player.cc
diff --git a/remoting/client/plugin/pepper_audio_player.cc b/remoting/client/plugin/pepper_audio_player.cc
index dae8c1e9ba7099b1fb2e175d65be80ce8d5df44b..69fd252c97cee8ea99c9904b8c301b729ace6e73 100644
--- a/remoting/client/plugin/pepper_audio_player.cc
+++ b/remoting/client/plugin/pepper_audio_player.cc
@@ -81,6 +81,9 @@ void PepperAudioPlayer::ProcessAudioPacket(scoped_ptr<AudioPacket> packet) {
CHECK_EQ(1, packet->data_size());
DCHECK_EQ(AudioPacket::ENCODING_RAW, packet->encoding());
+ DCHECK_NE(AudioPacket::SAMPLING_RATE_INVALID, packet->sampling_rate());
+ DCHECK_NE(AudioPacket::BYTES_PER_SAMPLE_INVALID, packet->bytes_per_sample());
Sergey Ulanov 2012/08/20 22:26:20 check that bytes_per_sample() == kSampleSizeBytes?
kxing 2012/08/20 22:48:22 Done.
+ DCHECK_NE(AudioPacket::CHANNELS_INVALID, packet->channels());
Sergey Ulanov 2012/08/20 22:26:20 I think you want to check that channels()==kChanne
kxing 2012/08/20 22:48:22 Done.
if (packet->data(0).size() % (kChannels * kSampleSizeBytes) != 0) {
Sergey Ulanov 2012/08/20 22:26:20 add empty line above this one.
kxing 2012/08/20 22:48:22 Done.
LOG(WARNING) << "Received corrupted packet.";
return;
« no previous file with comments | « no previous file | remoting/codec/audio_decoder_verbatim.cc » ('j') | remoting/codec/audio_decoder_verbatim.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698