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 44487707402520b67739243656f5d0a7177ea238..d8971ddb1cf8a53b1f0d5b143d8de7488e3446e4 100644 |
--- a/remoting/client/plugin/pepper_audio_player.cc |
+++ b/remoting/client/plugin/pepper_audio_player.cc |
@@ -74,7 +74,14 @@ bool PepperAudioPlayer::ResetAudioPlayer( |
void PepperAudioPlayer::ProcessAudioPacket(scoped_ptr<AudioPacket> packet) { |
// TODO(kxing): Limit the size of the queue so that latency doesn't grow |
// too large. |
- if (packet->data().size() % (kChannels * kSampleSizeBytes) != 0) { |
+ |
+ // Drop null packets. |
+ if (!packet.get()) |
Sergey Ulanov
2012/08/15 00:47:20
You don't need this. scoped_ptr's -> operation wil
kxing
2012/08/15 16:00:05
A packet might end up null if some malicious host
Sergey Ulanov
2012/08/15 17:38:10
Oh, I see. Maybe better to handle this case in Aud
|
+ return; |
+ |
+ CHECK_EQ(1, packet->data_size()); |
+ CHECK_EQ(AudioPacket::ENCODING_RAW, packet->encoding()); |
Sergey Ulanov
2012/08/15 00:47:20
nit: this doesn't really need to be CHECK - DCHECK
kxing
2012/08/15 16:00:05
Done.
|
+ if (packet->data(0).size() % (kChannels * kSampleSizeBytes) != 0) { |
LOG(WARNING) << "Received corrupted packet."; |
return; |
} |
@@ -129,14 +136,14 @@ void PepperAudioPlayer::FillWithSamples(void* samples, uint32_t buffer_size) { |
} |
// Pop off the packet if we've already consumed all its bytes. |
- if (queued_packets_.front()->data().size() == bytes_consumed_) { |
+ if (queued_packets_.front()->data(0).size() == bytes_consumed_) { |
delete queued_packets_.front(); |
queued_packets_.pop_front(); |
bytes_consumed_ = 0; |
continue; |
} |
- const std::string& packet_data = queued_packets_.front()->data(); |
+ const std::string& packet_data = queued_packets_.front()->data(0); |
size_t bytes_to_copy = std::min( |
packet_data.size() - bytes_consumed_, |
bytes_needed - bytes_extracted); |