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

Side by Side Diff: media/base/composite_filter.cc

Issue 9310028: Update AudioRenderer, VideoRenderer, and AudioDecoder Initialize() methods to use PipelineStatusCB. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 | « no previous file | media/base/filters.h » ('j') | media/base/mock_filters.cc » ('J')
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) 2011 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 "media/base/composite_filter.h" 5 #include "media/base/composite_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 436
437 void CompositeFilter::OnStatusCB(const base::Closure& callback, 437 void CompositeFilter::OnStatusCB(const base::Closure& callback,
438 PipelineStatus status) { 438 PipelineStatus status) {
439 if (status != PIPELINE_OK) 439 if (status != PIPELINE_OK)
440 SetError(status); 440 SetError(status);
441 441
442 callback.Run(); 442 callback.Run();
443 } 443 }
444 444
445 void CompositeFilter::SetError(PipelineStatus error) { 445 void CompositeFilter::SetError(PipelineStatus error) {
446 // TODO(acolwell): Temporary hack to handle errors that occur
447 // during filter initialization. In this case we just forward
448 // the error to the host even if it is on the wrong thread. We
449 // have to do this because if we defer the call, we can't be
450 // sure the host will get the error before the "init done" callback
451 // is executed. This will be cleaned up when filter init is refactored.
452 if (state_ == kCreated) {
453 SendErrorToHost(error);
454 return;
455 }
456
457 if (message_loop_ != MessageLoop::current()) { 446 if (message_loop_ != MessageLoop::current()) {
458 message_loop_->PostTask(FROM_HERE, 447 message_loop_->PostTask(FROM_HERE,
459 base::Bind(&CompositeFilter::SetError, this, error)); 448 base::Bind(&CompositeFilter::SetError, this, error));
460 return; 449 return;
461 } 450 }
462 451
463 DCHECK_EQ(message_loop_, MessageLoop::current()); 452 DCHECK_EQ(message_loop_, MessageLoop::current());
Ami GONE FROM CHROMIUM 2012/02/01 18:39:11 DCHECK_NE(state_, kCreated);
acolwell GONE FROM CHROMIUM 2012/02/01 19:59:46 Done.
464 453
465 // Drop errors recieved while stopping or stopped. 454 // Drop errors recieved while stopping or stopped.
466 // This shields the owner of this object from having 455 // This shields the owner of this object from having
467 // to deal with errors it can't do anything about. 456 // to deal with errors it can't do anything about.
468 if (state_ == kStopPending || state_ == kStopped) 457 if (state_ == kStopPending || state_ == kStopped)
469 return; 458 return;
470 459
471 status_ = error; 460 status_ = error;
472 if (CanForwardError()) 461 if (CanForwardError())
473 SendErrorToHost(error); 462 SendErrorToHost(error);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 496
508 void CompositeFilter::FilterHostImpl::NotifyEnded() { 497 void CompositeFilter::FilterHostImpl::NotifyEnded() {
509 host_->NotifyEnded(); 498 host_->NotifyEnded();
510 } 499 }
511 500
512 void CompositeFilter::FilterHostImpl::DisableAudioRenderer() { 501 void CompositeFilter::FilterHostImpl::DisableAudioRenderer() {
513 host_->DisableAudioRenderer(); 502 host_->DisableAudioRenderer();
514 } 503 }
515 504
516 } // namespace media 505 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/base/filters.h » ('j') | media/base/mock_filters.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698