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

Unified Diff: remoting/protocol/audio_reader.cc

Issue 1654513003: Simplify message parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_done
Patch Set: Created 4 years, 11 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 | « remoting/protocol/audio_reader.h ('k') | remoting/protocol/audio_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/audio_reader.cc
diff --git a/remoting/protocol/audio_reader.cc b/remoting/protocol/audio_reader.cc
index d197a83d57d81aa45a6473d45ce80de310088d20..e7511f6d8463827f0ac325a82f528dd10e28d9d8 100644
--- a/remoting/protocol/audio_reader.cc
+++ b/remoting/protocol/audio_reader.cc
@@ -7,6 +7,9 @@
#include "base/bind.h"
#include "net/socket/stream_socket.h"
#include "remoting/base/constants.h"
+#include "remoting/proto/audio.pb.h"
+#include "remoting/protocol/audio_stub.h"
+#include "remoting/protocol/message_serialization.h"
#include "remoting/protocol/session.h"
#include "remoting/protocol/session_config.h"
@@ -14,16 +17,17 @@ namespace remoting {
namespace protocol {
AudioReader::AudioReader(AudioStub* audio_stub)
- : ChannelDispatcherBase(kAudioChannelName),
- audio_stub_(audio_stub),
- parser_(base::Bind(&AudioReader::OnAudioPacket, base::Unretained(this)),
- reader()) {}
+ : ChannelDispatcherBase(kAudioChannelName), audio_stub_(audio_stub) {}
AudioReader::~AudioReader() {}
-void AudioReader::OnAudioPacket(scoped_ptr<AudioPacket> audio_packet) {
- audio_stub_->ProcessAudioPacket(std::move(audio_packet),
- base::Bind(&base::DoNothing));
+void AudioReader::OnIncomingMessage(scoped_ptr<CompoundBuffer> message) {
+ scoped_ptr<AudioPacket> audio_packet =
+ ParseMessage<AudioPacket>(message.get());
+ if (audio_packet) {
+ audio_stub_->ProcessAudioPacket(std::move(audio_packet),
+ base::Bind(&base::DoNothing));
+ }
}
} // namespace protocol
« no previous file with comments | « remoting/protocol/audio_reader.h ('k') | remoting/protocol/audio_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698