| 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/source_buffer_stream.h" | 5 #include "media/filters/source_buffer_stream.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 NOTREACHED(); | 122 NOTREACHED(); |
| 123 return SourceBufferRange::NO_GAPS_ALLOWED; | 123 return SourceBufferRange::NO_GAPS_ALLOWED; |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace | 126 } // namespace |
| 127 | 127 |
| 128 SourceBufferStream::SourceBufferStream(const AudioDecoderConfig& audio_config, | 128 SourceBufferStream::SourceBufferStream(const AudioDecoderConfig& audio_config, |
| 129 const scoped_refptr<MediaLog>& media_log, | 129 const scoped_refptr<MediaLog>& media_log, |
| 130 bool splice_frames_enabled) | 130 bool splice_frames_enabled) |
| 131 : media_log_(media_log), | 131 : media_log_(media_log), |
| 132 current_config_index_(0), | |
| 133 append_config_index_(0), | |
| 134 seek_pending_(false), | |
| 135 end_of_stream_(false), | |
| 136 seek_buffer_timestamp_(kNoTimestamp()), | 132 seek_buffer_timestamp_(kNoTimestamp()), |
| 137 selected_range_(NULL), | |
| 138 just_exhausted_track_buffer_(false), | |
| 139 media_segment_start_time_(kNoDecodeTimestamp()), | 133 media_segment_start_time_(kNoDecodeTimestamp()), |
| 140 range_for_next_append_(ranges_.end()), | 134 range_for_next_append_(ranges_.end()), |
| 141 new_media_segment_(false), | |
| 142 last_appended_buffer_timestamp_(kNoDecodeTimestamp()), | 135 last_appended_buffer_timestamp_(kNoDecodeTimestamp()), |
| 143 last_appended_buffer_is_keyframe_(false), | |
| 144 last_output_buffer_timestamp_(kNoDecodeTimestamp()), | 136 last_output_buffer_timestamp_(kNoDecodeTimestamp()), |
| 145 max_interbuffer_distance_(kNoTimestamp()), | 137 max_interbuffer_distance_(kNoTimestamp()), |
| 146 memory_limit_(kSourceBufferAudioMemoryLimit), | 138 memory_limit_(kSourceBufferAudioMemoryLimit), |
| 147 config_change_pending_(false), | 139 splice_frames_enabled_(splice_frames_enabled) { |
| 148 splice_buffers_index_(0), | |
| 149 pending_buffers_complete_(false), | |
| 150 splice_frames_enabled_(splice_frames_enabled), | |
| 151 num_splice_generation_warning_logs_(0), | |
| 152 num_splice_generation_success_logs_(0), | |
| 153 num_track_buffer_gap_warning_logs_(0) { | |
| 154 DCHECK(audio_config.IsValidConfig()); | 140 DCHECK(audio_config.IsValidConfig()); |
| 155 audio_configs_.push_back(audio_config); | 141 audio_configs_.push_back(audio_config); |
| 156 } | 142 } |
| 157 | 143 |
| 158 SourceBufferStream::SourceBufferStream(const VideoDecoderConfig& video_config, | 144 SourceBufferStream::SourceBufferStream(const VideoDecoderConfig& video_config, |
| 159 const scoped_refptr<MediaLog>& media_log, | 145 const scoped_refptr<MediaLog>& media_log, |
| 160 bool splice_frames_enabled) | 146 bool splice_frames_enabled) |
| 161 : media_log_(media_log), | 147 : media_log_(media_log), |
| 162 current_config_index_(0), | |
| 163 append_config_index_(0), | |
| 164 seek_pending_(false), | |
| 165 end_of_stream_(false), | |
| 166 seek_buffer_timestamp_(kNoTimestamp()), | 148 seek_buffer_timestamp_(kNoTimestamp()), |
| 167 selected_range_(NULL), | |
| 168 just_exhausted_track_buffer_(false), | |
| 169 media_segment_start_time_(kNoDecodeTimestamp()), | 149 media_segment_start_time_(kNoDecodeTimestamp()), |
| 170 range_for_next_append_(ranges_.end()), | 150 range_for_next_append_(ranges_.end()), |
| 171 new_media_segment_(false), | |
| 172 last_appended_buffer_timestamp_(kNoDecodeTimestamp()), | 151 last_appended_buffer_timestamp_(kNoDecodeTimestamp()), |
| 173 last_appended_buffer_is_keyframe_(false), | |
| 174 last_output_buffer_timestamp_(kNoDecodeTimestamp()), | 152 last_output_buffer_timestamp_(kNoDecodeTimestamp()), |
| 175 max_interbuffer_distance_(kNoTimestamp()), | 153 max_interbuffer_distance_(kNoTimestamp()), |
| 176 memory_limit_(kSourceBufferVideoMemoryLimit), | 154 memory_limit_(kSourceBufferVideoMemoryLimit), |
| 177 config_change_pending_(false), | 155 splice_frames_enabled_(splice_frames_enabled) { |
| 178 splice_buffers_index_(0), | |
| 179 pending_buffers_complete_(false), | |
| 180 splice_frames_enabled_(splice_frames_enabled), | |
| 181 num_splice_generation_warning_logs_(0), | |
| 182 num_splice_generation_success_logs_(0), | |
| 183 num_track_buffer_gap_warning_logs_(0) { | |
| 184 DCHECK(video_config.IsValidConfig()); | 156 DCHECK(video_config.IsValidConfig()); |
| 185 video_configs_.push_back(video_config); | 157 video_configs_.push_back(video_config); |
| 186 } | 158 } |
| 187 | 159 |
| 188 SourceBufferStream::SourceBufferStream(const TextTrackConfig& text_config, | 160 SourceBufferStream::SourceBufferStream(const TextTrackConfig& text_config, |
| 189 const scoped_refptr<MediaLog>& media_log, | 161 const scoped_refptr<MediaLog>& media_log, |
| 190 bool splice_frames_enabled) | 162 bool splice_frames_enabled) |
| 191 : media_log_(media_log), | 163 : media_log_(media_log), |
| 192 current_config_index_(0), | |
| 193 append_config_index_(0), | |
| 194 text_track_config_(text_config), | 164 text_track_config_(text_config), |
| 195 seek_pending_(false), | |
| 196 end_of_stream_(false), | |
| 197 seek_buffer_timestamp_(kNoTimestamp()), | 165 seek_buffer_timestamp_(kNoTimestamp()), |
| 198 selected_range_(NULL), | |
| 199 just_exhausted_track_buffer_(false), | |
| 200 media_segment_start_time_(kNoDecodeTimestamp()), | 166 media_segment_start_time_(kNoDecodeTimestamp()), |
| 201 range_for_next_append_(ranges_.end()), | 167 range_for_next_append_(ranges_.end()), |
| 202 new_media_segment_(false), | |
| 203 last_appended_buffer_timestamp_(kNoDecodeTimestamp()), | 168 last_appended_buffer_timestamp_(kNoDecodeTimestamp()), |
| 204 last_appended_buffer_is_keyframe_(false), | |
| 205 last_output_buffer_timestamp_(kNoDecodeTimestamp()), | 169 last_output_buffer_timestamp_(kNoDecodeTimestamp()), |
| 206 max_interbuffer_distance_(kNoTimestamp()), | 170 max_interbuffer_distance_(kNoTimestamp()), |
| 207 memory_limit_(kSourceBufferAudioMemoryLimit), | 171 memory_limit_(kSourceBufferAudioMemoryLimit), |
| 208 config_change_pending_(false), | 172 splice_frames_enabled_(splice_frames_enabled) {} |
| 209 splice_buffers_index_(0), | |
| 210 pending_buffers_complete_(false), | |
| 211 splice_frames_enabled_(splice_frames_enabled), | |
| 212 num_splice_generation_warning_logs_(0), | |
| 213 num_splice_generation_success_logs_(0), | |
| 214 num_track_buffer_gap_warning_logs_(0) {} | |
| 215 | 173 |
| 216 SourceBufferStream::~SourceBufferStream() { | 174 SourceBufferStream::~SourceBufferStream() { |
| 217 while (!ranges_.empty()) { | 175 while (!ranges_.empty()) { |
| 218 delete ranges_.front(); | 176 delete ranges_.front(); |
| 219 ranges_.pop_front(); | 177 ranges_.pop_front(); |
| 220 } | 178 } |
| 221 } | 179 } |
| 222 | 180 |
| 223 void SourceBufferStream::OnNewMediaSegment( | 181 void SourceBufferStream::OnNewMediaSegment( |
| 224 DecodeTimestamp media_segment_start_time) { | 182 DecodeTimestamp media_segment_start_time) { |
| (...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 return false; | 1665 return false; |
| 1708 | 1666 |
| 1709 DCHECK_NE(have_splice_buffers, have_preroll_buffer); | 1667 DCHECK_NE(have_splice_buffers, have_preroll_buffer); |
| 1710 splice_buffers_index_ = 0; | 1668 splice_buffers_index_ = 0; |
| 1711 pending_buffer_.swap(*out_buffer); | 1669 pending_buffer_.swap(*out_buffer); |
| 1712 pending_buffers_complete_ = false; | 1670 pending_buffers_complete_ = false; |
| 1713 return true; | 1671 return true; |
| 1714 } | 1672 } |
| 1715 | 1673 |
| 1716 } // namespace media | 1674 } // namespace media |
| OLD | NEW |