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

Side by Side Diff: media/filters/video_renderer_base.cc

Issue 155711: Renamed FilterHost::Error() and Pipeline::GetTime() to more appropriate names. (Closed)
Patch Set: Created 11 years, 5 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 | « media/filters/file_data_source.cc ('k') | media/filters/video_renderer_base_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) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "media/base/buffers.h" 5 #include "media/base/buffers.h"
6 #include "media/base/filter_host.h" 6 #include "media/base/filter_host.h"
7 #include "media/filters/video_renderer_base.h" 7 #include "media/filters/video_renderer_base.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 DCHECK(callback); 100 DCHECK(callback);
101 DCHECK_EQ(state_, UNINITIALIZED); 101 DCHECK_EQ(state_, UNINITIALIZED);
102 state_ = INITIALIZING; 102 state_ = INITIALIZING;
103 decoder_ = decoder; 103 decoder_ = decoder;
104 initialize_callback_.reset(callback); 104 initialize_callback_.reset(callback);
105 105
106 // Notify the pipeline of the video dimensions. 106 // Notify the pipeline of the video dimensions.
107 int width = 0; 107 int width = 0;
108 int height = 0; 108 int height = 0;
109 if (!ParseMediaFormat(decoder->media_format(), &width, &height)) { 109 if (!ParseMediaFormat(decoder->media_format(), &width, &height)) {
110 host()->Error(PIPELINE_ERROR_INITIALIZATION_FAILED); 110 host()->SetError(PIPELINE_ERROR_INITIALIZATION_FAILED);
111 initialize_callback_->Run(); 111 initialize_callback_->Run();
112 initialize_callback_.reset(); 112 initialize_callback_.reset();
113 return; 113 return;
114 } 114 }
115 host()->SetVideoSize(width, height); 115 host()->SetVideoSize(width, height);
116 116
117 // Initialize the subclass. 117 // Initialize the subclass.
118 // TODO(scherkus): do we trust subclasses not to do something silly while 118 // TODO(scherkus): do we trust subclasses not to do something silly while
119 // we're holding the lock? 119 // we're holding the lock?
120 if (!OnInitialize(decoder)) { 120 if (!OnInitialize(decoder)) {
121 host()->Error(PIPELINE_ERROR_INITIALIZATION_FAILED); 121 host()->SetError(PIPELINE_ERROR_INITIALIZATION_FAILED);
122 initialize_callback_->Run(); 122 initialize_callback_->Run();
123 initialize_callback_.reset(); 123 initialize_callback_.reset();
124 return; 124 return;
125 } 125 }
126 126
127 // Create our video thread. 127 // Create our video thread.
128 if (!PlatformThread::Create(0, this, &thread_)) { 128 if (!PlatformThread::Create(0, this, &thread_)) {
129 NOTREACHED() << "Video thread creation failed"; 129 NOTREACHED() << "Video thread creation failed";
130 host()->Error(PIPELINE_ERROR_INITIALIZATION_FAILED); 130 host()->SetError(PIPELINE_ERROR_INITIALIZATION_FAILED);
131 initialize_callback_->Run(); 131 initialize_callback_->Run();
132 initialize_callback_.reset(); 132 initialize_callback_.reset();
133 return; 133 return;
134 } 134 }
135 135
136 #if defined(OS_WIN) 136 #if defined(OS_WIN)
137 // Bump up our priority so our sleeping is more accurate. 137 // Bump up our priority so our sleeping is more accurate.
138 // TODO(scherkus): find out if this is necessary, but it seems to help. 138 // TODO(scherkus): find out if this is necessary, but it seems to help.
139 ::SetThreadPriority(thread_, THREAD_PRIORITY_ABOVE_NORMAL); 139 ::SetThreadPriority(thread_, THREAD_PRIORITY_ABOVE_NORMAL);
140 #endif // defined(OS_WIN) 140 #endif // defined(OS_WIN)
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 frame_available_.Signal(); 255 frame_available_.Signal();
256 } 256 }
257 257
258 // Check for our initialization condition. 258 // Check for our initialization condition.
259 if (state_ == INITIALIZING && 259 if (state_ == INITIALIZING &&
260 (frames_.size() == kMaxFrames || frame->IsEndOfStream())) { 260 (frames_.size() == kMaxFrames || frame->IsEndOfStream())) {
261 if (frames_.empty()) { 261 if (frames_.empty()) {
262 // We should have initialized but there's no decoded frames in the queue. 262 // We should have initialized but there's no decoded frames in the queue.
263 // Raise an error. 263 // Raise an error.
264 state_ = ERRORED; 264 state_ = ERRORED;
265 host()->Error(PIPELINE_ERROR_NO_DATA); 265 host()->SetError(PIPELINE_ERROR_NO_DATA);
266 initialize_callback_->Run(); 266 initialize_callback_->Run();
267 initialize_callback_.reset(); 267 initialize_callback_.reset();
268 } else { 268 } else {
269 state_ = INITIALIZED; 269 state_ = INITIALIZED;
270 current_frame_ = frames_.front(); 270 current_frame_ = frames_.front();
271 initialize_callback_->Run(); 271 initialize_callback_->Run();
272 initialize_callback_.reset(); 272 initialize_callback_.reset();
273 } 273 }
274 } 274 }
275 } 275 }
(...skipping 12 matching lines...) Expand all
288 } 288 }
289 if (state_ == STOPPED || state_ == ERRORED) { 289 if (state_ == STOPPED || state_ == ERRORED) {
290 return false; 290 return false;
291 } 291 }
292 DCHECK_EQ(state_, INITIALIZED); 292 DCHECK_EQ(state_, INITIALIZED);
293 DCHECK(current_frame_); 293 DCHECK(current_frame_);
294 return true; 294 return true;
295 } 295 }
296 296
297 } // namespace media 297 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/file_data_source.cc ('k') | media/filters/video_renderer_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698