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

Unified Diff: remoting/client/plugin/pepper_audio_player.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
« no previous file with comments | « no previous file | remoting/codec/audio_decoder_verbatim.cc » ('j') | remoting/host/audio_capturer_win.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 44487707402520b67739243656f5d0a7177ea238..8b167d5efd27bfa1dbe2e0962cb1a394dff9454d 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())
+ return;
+
+ DCHECK_EQ(1, packet->data_size());
Sergey Ulanov 2012/08/15 17:38:10 Actually I meant that we need CHECK() here, but DC
kxing 2012/08/15 18:41:55 Done.
+ DCHECK_EQ(AudioPacket::ENCODING_RAW, packet->encoding());
+ 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);
« no previous file with comments | « no previous file | remoting/codec/audio_decoder_verbatim.cc » ('j') | remoting/host/audio_capturer_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698