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/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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 | 599 |
600 scoped_ptr<StreamParser> stream_parser(factory_function()); | 600 scoped_ptr<StreamParser> stream_parser(factory_function()); |
601 CHECK(stream_parser.get()); | 601 CHECK(stream_parser.get()); |
602 | 602 |
603 stream_parser->Init( | 603 stream_parser->Init( |
604 base::Bind(&ChunkDemuxer::OnStreamParserInitDone, this), | 604 base::Bind(&ChunkDemuxer::OnStreamParserInitDone, this), |
605 base::Bind(&ChunkDemuxer::OnNewConfigs, base::Unretained(this), | 605 base::Bind(&ChunkDemuxer::OnNewConfigs, base::Unretained(this), |
606 has_audio, has_video), | 606 has_audio, has_video), |
607 audio_cb, | 607 audio_cb, |
608 video_cb, | 608 video_cb, |
609 base::Bind(&ChunkDemuxer::OnKeyNeeded, base::Unretained(this)), | 609 base::Bind(&ChunkDemuxer::OnNeedKey, base::Unretained(this)), |
610 base::Bind(&ChunkDemuxer::OnNewMediaSegment, base::Unretained(this), id)); | 610 base::Bind(&ChunkDemuxer::OnNewMediaSegment, base::Unretained(this), id)); |
611 | 611 |
612 stream_parser_map_[id] = stream_parser.release(); | 612 stream_parser_map_[id] = stream_parser.release(); |
613 | 613 |
614 return kOk; | 614 return kOk; |
615 } | 615 } |
616 | 616 |
617 void ChunkDemuxer::RemoveId(const std::string& id) { | 617 void ChunkDemuxer::RemoveId(const std::string& id) { |
618 CHECK_GT(stream_parser_map_.count(id), 0u); | 618 CHECK_GT(stream_parser_map_.count(id), 0u); |
619 base::AutoLock auto_lock(lock_); | 619 base::AutoLock auto_lock(lock_); |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 | 1011 |
1012 bool ChunkDemuxer::OnVideoBuffers(const StreamParser::BufferQueue& buffers) { | 1012 bool ChunkDemuxer::OnVideoBuffers(const StreamParser::BufferQueue& buffers) { |
1013 DCHECK_NE(state_, SHUTDOWN); | 1013 DCHECK_NE(state_, SHUTDOWN); |
1014 | 1014 |
1015 if (!video_) | 1015 if (!video_) |
1016 return false; | 1016 return false; |
1017 | 1017 |
1018 return video_->Append(buffers); | 1018 return video_->Append(buffers); |
1019 } | 1019 } |
1020 | 1020 |
1021 bool ChunkDemuxer::OnKeyNeeded(scoped_array<uint8> init_data, | 1021 bool ChunkDemuxer::OnNeedKey(scoped_array<uint8> init_data, |
1022 int init_data_size) { | 1022 int init_data_size) { |
1023 client_->KeyNeeded(init_data.Pass(), init_data_size); | 1023 client_->DemuxerNeedKey(init_data.Pass(), init_data_size); |
1024 return true; | 1024 return true; |
1025 } | 1025 } |
1026 | 1026 |
1027 void ChunkDemuxer::OnNewMediaSegment(const std::string& source_id, | 1027 void ChunkDemuxer::OnNewMediaSegment(const std::string& source_id, |
1028 base::TimeDelta start_timestamp) { | 1028 base::TimeDelta start_timestamp) { |
1029 // TODO(vrk): There should be a special case for the first appends where all | 1029 // TODO(vrk): There should be a special case for the first appends where all |
1030 // streams (for both demuxed and muxed case) begin at the earliest stream | 1030 // streams (for both demuxed and muxed case) begin at the earliest stream |
1031 // timestamp. (crbug.com/132815) | 1031 // timestamp. (crbug.com/132815) |
1032 if (audio_ && source_id == source_id_audio_) | 1032 if (audio_ && source_id == source_id_audio_) |
1033 audio_->OnNewMediaSegment(start_timestamp); | 1033 audio_->OnNewMediaSegment(start_timestamp); |
1034 if (video_ && source_id == source_id_video_) | 1034 if (video_ && source_id == source_id_video_) |
1035 video_->OnNewMediaSegment(start_timestamp); | 1035 video_->OnNewMediaSegment(start_timestamp); |
1036 } | 1036 } |
1037 | 1037 |
1038 } // namespace media | 1038 } // namespace media |
OLD | NEW |