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

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

Issue 10857062: Upgrade DCHECK(pending_callbacks_.get()) to CHECK(). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/pipeline.h" 5 #include "media/base/pipeline.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 TimeDelta epsilon = clock_->Duration() / 100; 417 TimeDelta epsilon = clock_->Duration() / 100;
418 if (time_offset < epsilon) 418 if (time_offset < epsilon)
419 return TimeDelta(); 419 return TimeDelta();
420 if (time_offset + epsilon > clock_->Duration()) 420 if (time_offset + epsilon > clock_->Duration())
421 return clock_->Duration(); 421 return clock_->Duration();
422 return time_offset; 422 return time_offset;
423 } 423 }
424 424
425 void Pipeline::DoPause(const PipelineStatusCB& done_cb) { 425 void Pipeline::DoPause(const PipelineStatusCB& done_cb) {
426 DCHECK(message_loop_->BelongsToCurrentThread()); 426 DCHECK(message_loop_->BelongsToCurrentThread());
427 DCHECK(!pending_callbacks_.get()); 427 CHECK(!pending_callbacks_.get());
428 SerialRunner::Queue bound_fns; 428 SerialRunner::Queue bound_fns;
429 429
430 if (audio_renderer_) 430 if (audio_renderer_)
431 bound_fns.Push(base::Bind(&AudioRenderer::Pause, audio_renderer_)); 431 bound_fns.Push(base::Bind(&AudioRenderer::Pause, audio_renderer_));
432 432
433 if (video_renderer_) 433 if (video_renderer_)
434 bound_fns.Push(base::Bind(&VideoRenderer::Pause, video_renderer_)); 434 bound_fns.Push(base::Bind(&VideoRenderer::Pause, video_renderer_));
435 435
436 pending_callbacks_ = SerialRunner::Run(bound_fns, done_cb); 436 pending_callbacks_ = SerialRunner::Run(bound_fns, done_cb);
437 } 437 }
438 438
439 void Pipeline::DoFlush(const PipelineStatusCB& done_cb) { 439 void Pipeline::DoFlush(const PipelineStatusCB& done_cb) {
440 DCHECK(message_loop_->BelongsToCurrentThread()); 440 DCHECK(message_loop_->BelongsToCurrentThread());
441 DCHECK(!pending_callbacks_.get()); 441 CHECK(!pending_callbacks_.get());
442 SerialRunner::Queue bound_fns; 442 SerialRunner::Queue bound_fns;
443 443
444 if (audio_renderer_) 444 if (audio_renderer_)
445 bound_fns.Push(base::Bind(&AudioRenderer::Flush, audio_renderer_)); 445 bound_fns.Push(base::Bind(&AudioRenderer::Flush, audio_renderer_));
446 446
447 if (video_renderer_) 447 if (video_renderer_)
448 bound_fns.Push(base::Bind(&VideoRenderer::Flush, video_renderer_)); 448 bound_fns.Push(base::Bind(&VideoRenderer::Flush, video_renderer_));
449 449
450 pending_callbacks_ = SerialRunner::Run(bound_fns, done_cb); 450 pending_callbacks_ = SerialRunner::Run(bound_fns, done_cb);
451 } 451 }
452 452
453 void Pipeline::DoPlay(const PipelineStatusCB& done_cb) { 453 void Pipeline::DoPlay(const PipelineStatusCB& done_cb) {
454 DCHECK(message_loop_->BelongsToCurrentThread()); 454 DCHECK(message_loop_->BelongsToCurrentThread());
455 DCHECK(!pending_callbacks_.get()); 455 CHECK(!pending_callbacks_.get());
456 SerialRunner::Queue bound_fns; 456 SerialRunner::Queue bound_fns;
457 457
458 if (audio_renderer_) 458 if (audio_renderer_)
459 bound_fns.Push(base::Bind(&AudioRenderer::Play, audio_renderer_)); 459 bound_fns.Push(base::Bind(&AudioRenderer::Play, audio_renderer_));
460 460
461 if (video_renderer_) 461 if (video_renderer_)
462 bound_fns.Push(base::Bind(&VideoRenderer::Play, video_renderer_)); 462 bound_fns.Push(base::Bind(&VideoRenderer::Play, video_renderer_));
463 463
464 pending_callbacks_ = SerialRunner::Run(bound_fns, done_cb); 464 pending_callbacks_ = SerialRunner::Run(bound_fns, done_cb);
465 } 465 }
466 466
467 void Pipeline::DoStop(const PipelineStatusCB& done_cb) { 467 void Pipeline::DoStop(const PipelineStatusCB& done_cb) {
468 DCHECK(message_loop_->BelongsToCurrentThread()); 468 DCHECK(message_loop_->BelongsToCurrentThread());
469 DCHECK(!pending_callbacks_.get()); 469 CHECK(!pending_callbacks_.get());
470 SerialRunner::Queue bound_fns; 470 SerialRunner::Queue bound_fns;
471 471
472 if (demuxer_) 472 if (demuxer_)
473 bound_fns.Push(base::Bind(&Demuxer::Stop, demuxer_)); 473 bound_fns.Push(base::Bind(&Demuxer::Stop, demuxer_));
474 474
475 if (audio_renderer_) 475 if (audio_renderer_)
476 bound_fns.Push(base::Bind(&AudioRenderer::Stop, audio_renderer_)); 476 bound_fns.Push(base::Bind(&AudioRenderer::Stop, audio_renderer_));
477 477
478 if (video_renderer_) 478 if (video_renderer_)
479 bound_fns.Push(base::Bind(&VideoRenderer::Stop, video_renderer_)); 479 bound_fns.Push(base::Bind(&VideoRenderer::Stop, video_renderer_));
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 demuxer_->OnAudioRendererDisabled(); 870 demuxer_->OnAudioRendererDisabled();
871 871
872 // Start clock since there is no more audio to 872 // Start clock since there is no more audio to
873 // trigger clock updates. 873 // trigger clock updates.
874 clock_->SetMaxTime(clock_->Duration()); 874 clock_->SetMaxTime(clock_->Duration());
875 StartClockIfWaitingForTimeUpdate_Locked(); 875 StartClockIfWaitingForTimeUpdate_Locked();
876 } 876 }
877 877
878 void Pipeline::FilterStateTransitionTask() { 878 void Pipeline::FilterStateTransitionTask() {
879 DCHECK(message_loop_->BelongsToCurrentThread()); 879 DCHECK(message_loop_->BelongsToCurrentThread());
880 DCHECK(pending_callbacks_.get()) 880 CHECK(pending_callbacks_.get())
881 << "Filter state transitions must be completed via pending_callbacks_"; 881 << "Filter state transitions must be completed via pending_callbacks_";
882 pending_callbacks_.reset(); 882 pending_callbacks_.reset();
883 883
884 // State transitions while tearing down are handled via 884 // State transitions while tearing down are handled via
885 // TeardownStateTransitionTask(). 885 // TeardownStateTransitionTask().
886 // 886 //
887 // TODO(scherkus): Merge all state machinery! 887 // TODO(scherkus): Merge all state machinery!
888 if (state_ == kStopped || tearing_down_) { 888 if (state_ == kStopped || tearing_down_) {
889 return; 889 return;
890 } 890 }
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 break; 1190 break;
1191 // default: intentionally left out to force new states to cause compiler 1191 // default: intentionally left out to force new states to cause compiler
1192 // errors. 1192 // errors.
1193 }; 1193 };
1194 } 1194 }
1195 1195
1196 void Pipeline::DoSeek(base::TimeDelta seek_timestamp, 1196 void Pipeline::DoSeek(base::TimeDelta seek_timestamp,
1197 bool skip_demuxer_seek, 1197 bool skip_demuxer_seek,
1198 const PipelineStatusCB& done_cb) { 1198 const PipelineStatusCB& done_cb) {
1199 DCHECK(message_loop_->BelongsToCurrentThread()); 1199 DCHECK(message_loop_->BelongsToCurrentThread());
1200 DCHECK(!pending_callbacks_.get()); 1200 CHECK(!pending_callbacks_.get());
1201 SerialRunner::Queue bound_fns; 1201 SerialRunner::Queue bound_fns;
1202 1202
1203 if (!skip_demuxer_seek) { 1203 if (!skip_demuxer_seek) {
1204 bound_fns.Push(base::Bind( 1204 bound_fns.Push(base::Bind(
1205 &Demuxer::Seek, demuxer_, seek_timestamp)); 1205 &Demuxer::Seek, demuxer_, seek_timestamp));
1206 } 1206 }
1207 1207
1208 if (audio_renderer_) { 1208 if (audio_renderer_) {
1209 bound_fns.Push(base::Bind( 1209 bound_fns.Push(base::Bind(
1210 &AudioRenderer::Preroll, audio_renderer_, seek_timestamp)); 1210 &AudioRenderer::Preroll, audio_renderer_, seek_timestamp));
(...skipping 24 matching lines...) Expand all
1235 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { 1235 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() {
1236 lock_.AssertAcquired(); 1236 lock_.AssertAcquired();
1237 if (!waiting_for_clock_update_) 1237 if (!waiting_for_clock_update_)
1238 return; 1238 return;
1239 1239
1240 waiting_for_clock_update_ = false; 1240 waiting_for_clock_update_ = false;
1241 clock_->Play(); 1241 clock_->Play();
1242 } 1242 }
1243 1243
1244 } // namespace media 1244 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698