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

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

Issue 10134066: Replace StreamParserHost interface with callbacks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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/chunk_demuxer.h ('k') | media/webm/webm_stream_parser.h » ('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) 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/filters/chunk_demuxer.h" 5 #include "media/filters/chunk_demuxer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "media/base/audio_decoder_config.h" 10 #include "media/base/audio_decoder_config.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 base::AutoLock auto_lock(lock_); 354 base::AutoLock auto_lock(lock_);
355 DCHECK_EQ(state_, WAITING_FOR_INIT); 355 DCHECK_EQ(state_, WAITING_FOR_INIT);
356 host_ = host; 356 host_ = host;
357 357
358 ChangeState_Locked(INITIALIZING); 358 ChangeState_Locked(INITIALIZING);
359 init_cb_ = cb; 359 init_cb_ = cb;
360 stream_parser_.reset(new WebMStreamParser()); 360 stream_parser_.reset(new WebMStreamParser());
361 361
362 stream_parser_->Init( 362 stream_parser_->Init(
363 base::Bind(&ChunkDemuxer::OnStreamParserInitDone, this), 363 base::Bind(&ChunkDemuxer::OnStreamParserInitDone, this),
364 this); 364 base::Bind(&ChunkDemuxer::OnNewConfigs, this),
scherkus (not reviewing) 2012/04/25 21:01:17 just as a precautionary FYI for these types of cha
acolwell GONE FROM CHROMIUM 2012/04/25 22:17:02 Good point. I've added base::Unretained so the cod
365 base::Bind(&ChunkDemuxer::OnAudioBuffers, this),
366 base::Bind(&ChunkDemuxer::OnVideoBuffers, this));
365 } 367 }
366 368
367 client_->DemuxerOpened(this); 369 client_->DemuxerOpened(this);
368 } 370 }
369 371
370 void ChunkDemuxer::Stop(const base::Closure& callback) { 372 void ChunkDemuxer::Stop(const base::Closure& callback) {
371 DVLOG(1) << "Stop()"; 373 DVLOG(1) << "Stop()";
372 Shutdown(); 374 Shutdown();
373 callback.Run(); 375 callback.Run();
374 } 376 }
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 if (video_config.IsValidConfig()) { 703 if (video_config.IsValidConfig()) {
702 if (video_.get()) 704 if (video_.get())
703 return false; 705 return false;
704 706
705 video_ = new ChunkDemuxerStream(video_config); 707 video_ = new ChunkDemuxerStream(video_config);
706 } 708 }
707 709
708 return true; 710 return true;
709 } 711 }
710 712
711 bool ChunkDemuxer::OnAudioBuffers(const BufferQueue& buffers) { 713 bool ChunkDemuxer::OnAudioBuffers(const StreamParser::BufferQueue& buffers) {
712 if (!audio_.get()) 714 if (!audio_.get())
713 return false; 715 return false;
714 716
715 if (!audio_->CanAddBuffers(buffers)) 717 if (!audio_->CanAddBuffers(buffers))
716 return false; 718 return false;
717 719
718 audio_->AddBuffers(buffers); 720 audio_->AddBuffers(buffers);
719 seek_waits_for_data_ = false; 721 seek_waits_for_data_ = false;
720 722
721 return true; 723 return true;
722 } 724 }
723 725
724 bool ChunkDemuxer::OnVideoBuffers(const BufferQueue& buffers) { 726 bool ChunkDemuxer::OnVideoBuffers(const StreamParser::BufferQueue& buffers) {
725 if (!video_.get()) 727 if (!video_.get())
726 return false; 728 return false;
727 729
728 if (!video_->CanAddBuffers(buffers)) 730 if (!video_->CanAddBuffers(buffers))
729 return false; 731 return false;
730 732
731 video_->AddBuffers(buffers); 733 video_->AddBuffers(buffers);
732 seek_waits_for_data_ = false; 734 seek_waits_for_data_ = false;
733 735
734 return true; 736 return true;
735 } 737 }
736 738
737 } // namespace media 739 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/webm/webm_stream_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698