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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <list> | 9 #include <list> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 | 1014 |
1015 if (!cb.is_null()) { | 1015 if (!cb.is_null()) { |
1016 cb.Run(error); | 1016 cb.Run(error); |
1017 return; | 1017 return; |
1018 } | 1018 } |
1019 | 1019 |
1020 base::AutoUnlock auto_unlock(lock_); | 1020 base::AutoUnlock auto_unlock(lock_); |
1021 host_->OnDemuxerError(error); | 1021 host_->OnDemuxerError(error); |
1022 } | 1022 } |
1023 | 1023 |
| 1024 void ChunkDemuxer::ReportMetadata_Locked() const { |
| 1025 DVLOG(1) << __func__; |
| 1026 lock_.AssertAcquired(); |
| 1027 DCHECK_EQ(state_, INITIALIZED); |
| 1028 |
| 1029 PipelineMetadata metadata; |
| 1030 metadata.timeline_offset = timeline_offset_; |
| 1031 if (video_) { |
| 1032 metadata.has_video = true; |
| 1033 metadata.natural_size = video_->video_decoder_config().natural_size(); |
| 1034 metadata.video_rotation = video_->video_rotation(); |
| 1035 } |
| 1036 if (audio_) { |
| 1037 metadata.has_audio = true; |
| 1038 } |
| 1039 |
| 1040 base::AutoUnlock auto_unlock(lock_); |
| 1041 host_->OnMetadata(metadata); |
| 1042 } |
| 1043 |
1024 bool ChunkDemuxer::IsSeekWaitingForData_Locked() const { | 1044 bool ChunkDemuxer::IsSeekWaitingForData_Locked() const { |
1025 lock_.AssertAcquired(); | 1045 lock_.AssertAcquired(); |
1026 for (MediaSourceStateMap::const_iterator itr = source_state_map_.begin(); | 1046 for (MediaSourceStateMap::const_iterator itr = source_state_map_.begin(); |
1027 itr != source_state_map_.end(); ++itr) { | 1047 itr != source_state_map_.end(); ++itr) { |
1028 if (itr->second->IsSeekWaitingForData()) | 1048 if (itr->second->IsSeekWaitingForData()) |
1029 return true; | 1049 return true; |
1030 } | 1050 } |
1031 | 1051 |
1032 return false; | 1052 return false; |
1033 } | 1053 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 | 1115 |
1096 SeekAllSources(GetStartTime()); | 1116 SeekAllSources(GetStartTime()); |
1097 StartReturningData(); | 1117 StartReturningData(); |
1098 | 1118 |
1099 if (duration_ == kNoTimestamp) | 1119 if (duration_ == kNoTimestamp) |
1100 duration_ = kInfiniteDuration; | 1120 duration_ = kInfiniteDuration; |
1101 | 1121 |
1102 // The demuxer is now initialized after the |start_timestamp_| was set. | 1122 // The demuxer is now initialized after the |start_timestamp_| was set. |
1103 ChangeState_Locked(INITIALIZED); | 1123 ChangeState_Locked(INITIALIZED); |
1104 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); | 1124 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); |
| 1125 |
| 1126 // Report metadata. |
| 1127 ReportMetadata_Locked(); |
1105 } | 1128 } |
1106 | 1129 |
1107 // static | 1130 // static |
1108 MediaTrack::Id ChunkDemuxer::GenerateMediaTrackId() { | 1131 MediaTrack::Id ChunkDemuxer::GenerateMediaTrackId() { |
1109 static unsigned g_track_count = 0; | 1132 static unsigned g_track_count = 0; |
1110 return base::UintToString(++g_track_count); | 1133 return base::UintToString(++g_track_count); |
1111 } | 1134 } |
1112 | 1135 |
1113 ChunkDemuxerStream* ChunkDemuxer::CreateDemuxerStream( | 1136 ChunkDemuxerStream* ChunkDemuxer::CreateDemuxerStream( |
1114 DemuxerStream::Type type) { | 1137 DemuxerStream::Type type) { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 } | 1283 } |
1261 | 1284 |
1262 void ChunkDemuxer::ShutdownAllStreams() { | 1285 void ChunkDemuxer::ShutdownAllStreams() { |
1263 for (MediaSourceStateMap::iterator itr = source_state_map_.begin(); | 1286 for (MediaSourceStateMap::iterator itr = source_state_map_.begin(); |
1264 itr != source_state_map_.end(); ++itr) { | 1287 itr != source_state_map_.end(); ++itr) { |
1265 itr->second->Shutdown(); | 1288 itr->second->Shutdown(); |
1266 } | 1289 } |
1267 } | 1290 } |
1268 | 1291 |
1269 } // namespace media | 1292 } // namespace media |
OLD | NEW |