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

Unified Diff: remoting/protocol/protobuf_video_reader.cc

Issue 7508044: Remove video_channel() from Session interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 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 | « remoting/protocol/protobuf_video_reader.h ('k') | remoting/protocol/protobuf_video_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/protobuf_video_reader.cc
diff --git a/remoting/protocol/protobuf_video_reader.cc b/remoting/protocol/protobuf_video_reader.cc
index a2b62388bfef8c6339ff085ff96a1d4544e69567..f93f2fb76cb126306aa0198e3236e4fe5670f333 100644
--- a/remoting/protocol/protobuf_video_reader.cc
+++ b/remoting/protocol/protobuf_video_reader.cc
@@ -4,7 +4,10 @@
#include "remoting/protocol/protobuf_video_reader.h"
+#include "base/bind.h"
#include "base/task.h"
+#include "net/socket/stream_socket.h"
+#include "remoting/base/constants.h"
#include "remoting/proto/video.pb.h"
#include "remoting/protocol/session.h"
@@ -19,11 +22,28 @@ ProtobufVideoReader::ProtobufVideoReader(VideoPacketFormat::Encoding encoding)
ProtobufVideoReader::~ProtobufVideoReader() { }
void ProtobufVideoReader::Init(protocol::Session* session,
- VideoStub* video_stub) {
- reader_.Init(
- session->video_channel(),
- NewCallback(this, &ProtobufVideoReader::OnNewData));
+ VideoStub* video_stub,
+ const InitializedCallback& callback) {
+ initialized_callback_ = callback;
video_stub_ = video_stub;
+
+ session->CreateStreamChannel(
+ kVideoChannelName,
+ base::Bind(&ProtobufVideoReader::OnChannelReady, base::Unretained(this)));
+}
+
+void ProtobufVideoReader::OnChannelReady(const std::string& name,
+ net::StreamSocket* socket) {
+ DCHECK_EQ(name, std::string(kVideoChannelName));
+ if (!socket) {
+ initialized_callback_.Run(false);
+ return;
+ }
+
+ DCHECK(!channel_.get());
+ channel_.reset(socket);
+ reader_.Init(socket, NewCallback(this, &ProtobufVideoReader::OnNewData));
+ initialized_callback_.Run(true);
}
void ProtobufVideoReader::OnNewData(VideoPacket* packet, Task* done_task) {
« no previous file with comments | « remoting/protocol/protobuf_video_reader.h ('k') | remoting/protocol/protobuf_video_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698