OLD | NEW |
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/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 if (has_video) { | 648 if (has_video) { |
649 source_id_video_ = id; | 649 source_id_video_ = id; |
650 video_cb = base::Bind(&ChunkDemuxer::OnVideoBuffers, | 650 video_cb = base::Bind(&ChunkDemuxer::OnVideoBuffers, |
651 base::Unretained(this)); | 651 base::Unretained(this)); |
652 } | 652 } |
653 | 653 |
654 scoped_ptr<StreamParser> stream_parser(factory_function(codecs)); | 654 scoped_ptr<StreamParser> stream_parser(factory_function(codecs)); |
655 CHECK(stream_parser.get()); | 655 CHECK(stream_parser.get()); |
656 | 656 |
657 stream_parser->Init( | 657 stream_parser->Init( |
658 base::Bind(&ChunkDemuxer::OnStreamParserInitDone, this), | 658 base::Bind(&ChunkDemuxer::OnStreamParserInitDone, base::Unretained(this)), |
659 base::Bind(&ChunkDemuxer::OnNewConfigs, base::Unretained(this), | 659 base::Bind(&ChunkDemuxer::OnNewConfigs, base::Unretained(this), |
660 has_audio, has_video), | 660 has_audio, has_video), |
661 audio_cb, | 661 audio_cb, |
662 video_cb, | 662 video_cb, |
663 base::Bind(&ChunkDemuxer::OnNeedKey, base::Unretained(this)), | 663 base::Bind(&ChunkDemuxer::OnNeedKey, base::Unretained(this)), |
664 base::Bind(&ChunkDemuxer::OnNewMediaSegment, base::Unretained(this), id)); | 664 base::Bind(&ChunkDemuxer::OnNewMediaSegment, base::Unretained(this), id)); |
665 | 665 |
666 stream_parser_map_[id] = stream_parser.release(); | 666 stream_parser_map_[id] = stream_parser.release(); |
667 | 667 |
668 return kOk; | 668 return kOk; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 return; | 850 return; |
851 | 851 |
852 std::swap(cb, seek_cb_); | 852 std::swap(cb, seek_cb_); |
853 | 853 |
854 if (audio_) | 854 if (audio_) |
855 audio_->Shutdown(); | 855 audio_->Shutdown(); |
856 | 856 |
857 if (video_) | 857 if (video_) |
858 video_->Shutdown(); | 858 video_->Shutdown(); |
859 | 859 |
860 for (StreamParserMap::iterator it = stream_parser_map_.begin(); | |
861 it != stream_parser_map_.end(); ++it) { | |
862 delete it->second; | |
863 } | |
864 stream_parser_map_.clear(); | |
865 | |
866 ChangeState_Locked(SHUTDOWN); | 860 ChangeState_Locked(SHUTDOWN); |
867 } | 861 } |
868 | 862 |
869 if (!cb.is_null()) | 863 if (!cb.is_null()) |
870 cb.Run(PIPELINE_ERROR_ABORT); | 864 cb.Run(PIPELINE_ERROR_ABORT); |
871 | 865 |
872 client_->DemuxerClosed(); | 866 client_->DemuxerClosed(); |
873 } | 867 } |
874 | 868 |
875 void ChunkDemuxer::ChangeState_Locked(State new_state) { | 869 void ChunkDemuxer::ChangeState_Locked(State new_state) { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 video_->SetStartTime(start_time_); | 1055 video_->SetStartTime(start_time_); |
1062 video_->Seek(start_time_); | 1056 video_->Seek(start_time_); |
1063 } | 1057 } |
1064 | 1058 |
1065 // The demuxer is now initialized after the |start_timestamp_| was set. | 1059 // The demuxer is now initialized after the |start_timestamp_| was set. |
1066 ChangeState_Locked(INITIALIZED); | 1060 ChangeState_Locked(INITIALIZED); |
1067 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); | 1061 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); |
1068 } | 1062 } |
1069 | 1063 |
1070 } // namespace media | 1064 } // namespace media |
OLD | NEW |