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

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

Issue 8936014: Removing DataSource from Filter hierarchy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved preload into a separate file. Created 9 years 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
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 // TODO(scherkus): clean up PipelineImpl... too many crazy function names, 5 // TODO(scherkus): clean up PipelineImpl... too many crazy function names,
6 // potential deadlocks, etc... 6 // potential deadlocks, etc...
7 7
8 #include "media/base/pipeline_impl.h" 8 #include "media/base/pipeline_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // position but threading issues between BufferedDataSource::DoneRead_Locked() 333 // position but threading issues between BufferedDataSource::DoneRead_Locked()
334 // and BufferedDataSource::NetworkEventCallback() can cause them to be 334 // and BufferedDataSource::NetworkEventCallback() can cause them to be
335 // temporarily out of sync. The easiest fix for this is to cap both 335 // temporarily out of sync. The easiest fix for this is to cap both
336 // buffered_bytes_ and current_bytes_ to always be legal values in 336 // buffered_bytes_ and current_bytes_ to always be legal values in
337 // SetCurrentReadPosition() and in SetBufferedBytes(). 337 // SetCurrentReadPosition() and in SetBufferedBytes().
338 if (offset > buffered_bytes_) 338 if (offset > buffered_bytes_)
339 buffered_bytes_ = offset; 339 buffered_bytes_ = offset;
340 current_bytes_ = offset; 340 current_bytes_ = offset;
341 } 341 }
342 342
343 int64 PipelineImpl::GetCurrentReadPosition() {
344 base::AutoLock auto_lock(lock_);
345 return current_bytes_;
346 }
347
348 void PipelineImpl::ResetState() { 343 void PipelineImpl::ResetState() {
349 base::AutoLock auto_lock(lock_); 344 base::AutoLock auto_lock(lock_);
350 const base::TimeDelta kZero; 345 const base::TimeDelta kZero;
351 running_ = false; 346 running_ = false;
352 stop_pending_ = false; 347 stop_pending_ = false;
353 seek_pending_ = false; 348 seek_pending_ = false;
354 tearing_down_ = false; 349 tearing_down_ = false;
355 error_caused_teardown_ = false; 350 error_caused_teardown_ = false;
356 playback_rate_change_pending_ = false; 351 playback_rate_change_pending_ = false;
357 duration_ = kZero; 352 duration_ = kZero;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 return kStarting; 445 return kStarting;
451 } else if (current == kStarting) { 446 } else if (current == kStarting) {
452 return kStarted; 447 return kStarted;
453 } else if (current == kStopping) { 448 } else if (current == kStopping) {
454 return error_caused_teardown_ ? kError : kStopped; 449 return error_caused_teardown_ ? kError : kStopped;
455 } else { 450 } else {
456 return current; 451 return current;
457 } 452 }
458 } 453 }
459 454
455 void PipelineImpl::OnDemuxerError(PipelineStatus error) {
456 SetError(error);
457 }
458
460 void PipelineImpl::SetError(PipelineStatus error) { 459 void PipelineImpl::SetError(PipelineStatus error) {
461 DCHECK(IsRunning()); 460 DCHECK(IsRunning());
462 DCHECK_NE(PIPELINE_OK, error); 461 DCHECK_NE(PIPELINE_OK, error);
463 VLOG(1) << "Media pipeline error: " << error; 462 VLOG(1) << "Media pipeline error: " << error;
464 463
465 message_loop_->PostTask(FROM_HERE, 464 message_loop_->PostTask(FROM_HERE,
466 base::Bind(&PipelineImpl::ErrorChangedTask, this, error)); 465 base::Bind(&PipelineImpl::ErrorChangedTask, this, error));
467 466
468 media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(error)); 467 media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(error));
469 } 468 }
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 message_loop_->PostTask(FROM_HERE, 1423 message_loop_->PostTask(FROM_HERE,
1425 base::Bind(&PipelineImpl::NotifyCanPlayThrough, this)); 1424 base::Bind(&PipelineImpl::NotifyCanPlayThrough, this));
1426 } 1425 }
1427 1426
1428 void PipelineImpl::NotifyCanPlayThrough() { 1427 void PipelineImpl::NotifyCanPlayThrough() {
1429 DCHECK_EQ(MessageLoop::current(), message_loop_); 1428 DCHECK_EQ(MessageLoop::current(), message_loop_);
1430 NotifyNetworkEventTask(CAN_PLAY_THROUGH); 1429 NotifyNetworkEventTask(CAN_PLAY_THROUGH);
1431 } 1430 }
1432 1431
1433 } // namespace media 1432 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline_impl.h ('k') | media/base/preload.h » ('j') | media/media.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698