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

Side by Side Diff: remoting/client/rectangle_update_decoder.cc

Issue 7062042: 1;2305;0cRevert 86971 - Move media library AutoTaskRunner to base and rename ScopedTaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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 | « media/filters/ffmpeg_audio_decoder.cc ('k') | remoting/host/client_session.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) 2011 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/client/rectangle_update_decoder.h" 5 #include "remoting/client/rectangle_update_decoder.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "media/base/callback.h"
9 #include "remoting/base/decoder.h" 10 #include "remoting/base/decoder.h"
10 #include "remoting/base/decoder_row_based.h" 11 #include "remoting/base/decoder_row_based.h"
11 #include "remoting/base/decoder_vp8.h" 12 #include "remoting/base/decoder_vp8.h"
12 #include "remoting/base/tracer.h" 13 #include "remoting/base/tracer.h"
13 #include "remoting/base/util.h" 14 #include "remoting/base/util.h"
14 #include "remoting/client/frame_consumer.h" 15 #include "remoting/client/frame_consumer.h"
15 #include "remoting/protocol/session_config.h" 16 #include "remoting/protocol/session_config.h"
16 17
18 using media::AutoTaskRunner;
17 using remoting::protocol::ChannelConfig; 19 using remoting::protocol::ChannelConfig;
18 using remoting::protocol::SessionConfig; 20 using remoting::protocol::SessionConfig;
19 21
20 namespace remoting { 22 namespace remoting {
21 23
22 namespace { 24 namespace {
23 25
24 class PartialFrameCleanup : public Task { 26 class PartialFrameCleanup : public Task {
25 public: 27 public:
26 PartialFrameCleanup(media::VideoFrame* frame, UpdatedRects* rects) 28 PartialFrameCleanup(media::VideoFrame* frame, UpdatedRects* rects)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void RectangleUpdateDecoder::DecodePacket(const VideoPacket* packet, 77 void RectangleUpdateDecoder::DecodePacket(const VideoPacket* packet,
76 Task* done) { 78 Task* done) {
77 if (message_loop_ != MessageLoop::current()) { 79 if (message_loop_ != MessageLoop::current()) {
78 message_loop_->PostTask( 80 message_loop_->PostTask(
79 FROM_HERE, 81 FROM_HERE,
80 NewTracedMethod(this, 82 NewTracedMethod(this,
81 &RectangleUpdateDecoder::DecodePacket, packet, 83 &RectangleUpdateDecoder::DecodePacket, packet,
82 done)); 84 done));
83 return; 85 return;
84 } 86 }
85 base::ScopedTaskRunner done_runner(done); 87 AutoTaskRunner done_runner(done);
86 88
87 TraceContext::tracer()->PrintString("Decode Packet called."); 89 TraceContext::tracer()->PrintString("Decode Packet called.");
88 90
89 AllocateFrame(packet, done_runner.Release()); 91 AllocateFrame(packet, done_runner.release());
90 } 92 }
91 93
92 void RectangleUpdateDecoder::AllocateFrame(const VideoPacket* packet, 94 void RectangleUpdateDecoder::AllocateFrame(const VideoPacket* packet,
93 Task* done) { 95 Task* done) {
94 if (message_loop_ != MessageLoop::current()) { 96 if (message_loop_ != MessageLoop::current()) {
95 message_loop_->PostTask( 97 message_loop_->PostTask(
96 FROM_HERE, 98 FROM_HERE,
97 NewTracedMethod(this, 99 NewTracedMethod(this,
98 &RectangleUpdateDecoder::AllocateFrame, packet, done)); 100 &RectangleUpdateDecoder::AllocateFrame, packet, done));
99 return; 101 return;
100 } 102 }
101 base::ScopedTaskRunner done_runner(done); 103 AutoTaskRunner done_runner(done);
102 104
103 TraceContext::tracer()->PrintString("AllocateFrame called."); 105 TraceContext::tracer()->PrintString("AllocateFrame called.");
104 106
105 // Find the required frame size. 107 // Find the required frame size.
106 bool has_screen_size = packet->format().has_screen_width() && 108 bool has_screen_size = packet->format().has_screen_width() &&
107 packet->format().has_screen_height(); 109 packet->format().has_screen_height();
108 gfx::Size screen_size(packet->format().screen_width(), 110 gfx::Size screen_size(packet->format().screen_width(),
109 packet->format().screen_height()); 111 packet->format().screen_height());
110 if (!has_screen_size) 112 if (!has_screen_size)
111 screen_size = initial_screen_size_; 113 screen_size = initial_screen_size_;
(...skipping 12 matching lines...) Expand all
124 frame_ = NULL; 126 frame_ = NULL;
125 } 127 }
126 TraceContext::tracer()->PrintString("Requesting new frame."); 128 TraceContext::tracer()->PrintString("Requesting new frame.");
127 129
128 consumer_->AllocateFrame(media::VideoFrame::RGB32, 130 consumer_->AllocateFrame(media::VideoFrame::RGB32,
129 screen_size.width(), screen_size.height(), 131 screen_size.width(), screen_size.height(),
130 base::TimeDelta(), base::TimeDelta(), 132 base::TimeDelta(), base::TimeDelta(),
131 &frame_, 133 &frame_,
132 NewRunnableMethod(this, 134 NewRunnableMethod(this,
133 &RectangleUpdateDecoder::ProcessPacketData, 135 &RectangleUpdateDecoder::ProcessPacketData,
134 packet, done_runner.Release())); 136 packet, done_runner.release()));
135 frame_is_new_ = true; 137 frame_is_new_ = true;
136 return; 138 return;
137 } 139 }
138 ProcessPacketData(packet, done_runner.Release()); 140 ProcessPacketData(packet, done_runner.release());
139 } 141 }
140 142
141 void RectangleUpdateDecoder::ProcessPacketData( 143 void RectangleUpdateDecoder::ProcessPacketData(
142 const VideoPacket* packet, Task* done) { 144 const VideoPacket* packet, Task* done) {
143 if (message_loop_ != MessageLoop::current()) { 145 if (message_loop_ != MessageLoop::current()) {
144 message_loop_->PostTask( 146 message_loop_->PostTask(
145 FROM_HERE, 147 FROM_HERE,
146 NewTracedMethod(this, 148 NewTracedMethod(this,
147 &RectangleUpdateDecoder::ProcessPacketData, packet, 149 &RectangleUpdateDecoder::ProcessPacketData, packet,
148 done)); 150 done));
149 return; 151 return;
150 } 152 }
151 base::ScopedTaskRunner done_runner(done); 153 AutoTaskRunner done_runner(done);
152 154
153 if (frame_is_new_) { 155 if (frame_is_new_) {
154 decoder_->Reset(); 156 decoder_->Reset();
155 decoder_->Initialize(frame_); 157 decoder_->Initialize(frame_);
156 frame_is_new_ = false; 158 frame_is_new_ = false;
157 } 159 }
158 160
159 if (!decoder_->IsReadyForData()) { 161 if (!decoder_->IsReadyForData()) {
160 // TODO(ajwong): This whole thing should move into an invalid state. 162 // TODO(ajwong): This whole thing should move into an invalid state.
161 LOG(ERROR) << "Decoder is unable to process data. Dropping packet."; 163 LOG(ERROR) << "Decoder is unable to process data. Dropping packet.";
162 return; 164 return;
163 } 165 }
164 166
165 TraceContext::tracer()->PrintString("Executing Decode."); 167 TraceContext::tracer()->PrintString("Executing Decode.");
166 168
167 if (decoder_->DecodePacket(packet) == Decoder::DECODE_DONE) { 169 if (decoder_->DecodePacket(packet) == Decoder::DECODE_DONE) {
168 UpdatedRects* rects = new UpdatedRects(); 170 UpdatedRects* rects = new UpdatedRects();
169 decoder_->GetUpdatedRects(rects); 171 decoder_->GetUpdatedRects(rects);
170 consumer_->OnPartialFrameOutput(frame_, rects, 172 consumer_->OnPartialFrameOutput(frame_, rects,
171 new PartialFrameCleanup(frame_, rects)); 173 new PartialFrameCleanup(frame_, rects));
172 } 174 }
173 } 175 }
174 176
175 } // namespace remoting 177 } // namespace remoting
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_audio_decoder.cc ('k') | remoting/host/client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698