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

Side by Side Diff: remoting/protocol/protobuf_video_writer.cc

Issue 550383002: Cleanup ChannelFactory interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « remoting/protocol/protobuf_video_reader.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/protocol/protobuf_video_writer.h" 5 #include "remoting/protocol/protobuf_video_writer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "net/socket/stream_socket.h" 8 #include "net/socket/stream_socket.h"
9 #include "remoting/base/constants.h" 9 #include "remoting/base/constants.h"
10 #include "remoting/proto/video.pb.h" 10 #include "remoting/proto/video.pb.h"
(...skipping 10 matching lines...) Expand all
21 21
22 ProtobufVideoWriter::~ProtobufVideoWriter() { 22 ProtobufVideoWriter::~ProtobufVideoWriter() {
23 Close(); 23 Close();
24 } 24 }
25 25
26 void ProtobufVideoWriter::Init(protocol::Session* session, 26 void ProtobufVideoWriter::Init(protocol::Session* session,
27 const InitializedCallback& callback) { 27 const InitializedCallback& callback) {
28 channel_factory_ = session->GetTransportChannelFactory(); 28 channel_factory_ = session->GetTransportChannelFactory();
29 initialized_callback_ = callback; 29 initialized_callback_ = callback;
30 30
31 channel_factory_->CreateStreamChannel( 31 channel_factory_->CreateChannel(
32 kVideoChannelName, 32 kVideoChannelName,
33 base::Bind(&ProtobufVideoWriter::OnChannelReady, base::Unretained(this))); 33 base::Bind(&ProtobufVideoWriter::OnChannelReady, base::Unretained(this)));
34 } 34 }
35 35
36 void ProtobufVideoWriter::OnChannelReady(scoped_ptr<net::StreamSocket> socket) { 36 void ProtobufVideoWriter::OnChannelReady(scoped_ptr<net::StreamSocket> socket) {
37 if (!socket.get()) { 37 if (!socket.get()) {
38 initialized_callback_.Run(false); 38 initialized_callback_.Run(false);
39 return; 39 return;
40 } 40 }
41 41
(...skipping 19 matching lines...) Expand all
61 return channel_.get() != NULL; 61 return channel_.get() != NULL;
62 } 62 }
63 63
64 void ProtobufVideoWriter::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, 64 void ProtobufVideoWriter::ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
65 const base::Closure& done) { 65 const base::Closure& done) {
66 buffered_writer_.Write(SerializeAndFrameMessage(*packet), done); 66 buffered_writer_.Write(SerializeAndFrameMessage(*packet), done);
67 } 67 }
68 68
69 } // namespace protocol 69 } // namespace protocol
70 } // namespace remoting 70 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/protobuf_video_reader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698