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

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

Issue 8116021: Switch remoting/protocol to new callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/rtp_video_writer.h ('k') | remoting/protocol/rtp_video_writer_unittest.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/rtp_video_writer.h" 5 #include "remoting/protocol/rtp_video_writer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "remoting/base/compound_buffer.h" 10 #include "remoting/base/compound_buffer.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 initialized_callback_.Run(true); 67 initialized_callback_.Run(true);
68 } 68 }
69 } 69 }
70 70
71 void RtpVideoWriter::Close() { 71 void RtpVideoWriter::Close() {
72 rtp_writer_.Close(); 72 rtp_writer_.Close();
73 rtp_channel_.reset(); 73 rtp_channel_.reset();
74 rtcp_channel_.reset(); 74 rtcp_channel_.reset();
75 } 75 }
76 76
77 void RtpVideoWriter::ProcessVideoPacket(const VideoPacket* packet, Task* done) { 77 void RtpVideoWriter::ProcessVideoPacket(const VideoPacket* packet,
78 const base::Closure& done) {
78 CHECK(packet->format().encoding() == VideoPacketFormat::ENCODING_VP8) 79 CHECK(packet->format().encoding() == VideoPacketFormat::ENCODING_VP8)
79 << "Only VP8 is supported in RTP."; 80 << "Only VP8 is supported in RTP.";
80 81
81 CompoundBuffer payload; 82 CompoundBuffer payload;
82 // TODO(sergeyu): This copy would not be necessary CompoundBuffer was used 83 // TODO(sergeyu): This copy would not be necessary CompoundBuffer was used
83 // inside of VideoPacket. 84 // inside of VideoPacket.
84 payload.AppendCopyOf(packet->data().data(), packet->data().size()); 85 payload.AppendCopyOf(packet->data().data(), packet->data().size());
85 86
86 Vp8Descriptor vp8_desriptor; 87 Vp8Descriptor vp8_desriptor;
87 // TODO(sergeyu): Add a flag in VideoPacket that indicates whether this is a 88 // TODO(sergeyu): Add a flag in VideoPacket that indicates whether this is a
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 CompoundBuffer chunk; 122 CompoundBuffer chunk;
122 chunk.CopyFrom(payload, position, position + size); 123 chunk.CopyFrom(payload, position, position + size);
123 124
124 // And send it. 125 // And send it.
125 rtp_writer_.SendPacket(packet->timestamp(), marker, vp8_desriptor, chunk); 126 rtp_writer_.SendPacket(packet->timestamp(), marker, vp8_desriptor, chunk);
126 127
127 position += size; 128 position += size;
128 } 129 }
129 DCHECK_EQ(position, payload.total_bytes()); 130 DCHECK_EQ(position, payload.total_bytes());
130 131
131 done->Run(); 132 done.Run();
132 delete done;
133 } 133 }
134 134
135 int RtpVideoWriter::GetPendingPackets() { 135 int RtpVideoWriter::GetPendingPackets() {
136 return rtp_writer_.GetPendingPackets(); 136 return rtp_writer_.GetPendingPackets();
137 } 137 }
138 138
139 } // namespace protocol 139 } // namespace protocol
140 } // namespace remoting 140 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/rtp_video_writer.h ('k') | remoting/protocol/rtp_video_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698