Index: remoting/protocol/protobuf_video_reader.cc |
diff --git a/remoting/protocol/protobuf_video_reader.cc b/remoting/protocol/protobuf_video_reader.cc |
index cf5d1a989689723180888712dbe5f3f02d5dfa2a..0bcc9fe9b354129c2351177a0a635c12c8e17201 100644 |
--- a/remoting/protocol/protobuf_video_reader.cc |
+++ b/remoting/protocol/protobuf_video_reader.cc |
@@ -15,19 +15,24 @@ namespace remoting { |
namespace protocol { |
ProtobufVideoReader::ProtobufVideoReader(VideoPacketFormat::Encoding encoding) |
- : encoding_(encoding), |
+ : session_(NULL), |
+ encoding_(encoding), |
video_stub_(NULL) { |
} |
-ProtobufVideoReader::~ProtobufVideoReader() { } |
+ProtobufVideoReader::~ProtobufVideoReader() { |
+ if (session_) |
+ session_->CancelChannelCreation(kVideoChannelName); |
+} |
void ProtobufVideoReader::Init(protocol::Session* session, |
VideoStub* video_stub, |
const InitializedCallback& callback) { |
+ session_ = session; |
initialized_callback_ = callback; |
video_stub_ = video_stub; |
- session->CreateStreamChannel( |
+ session_->CreateStreamChannel( |
kVideoChannelName, |
base::Bind(&ProtobufVideoReader::OnChannelReady, base::Unretained(this))); |
} |