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

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

Issue 1261423002: Media: Nicer MSE append logging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | no next file » | 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/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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 last_appended_buffer_timestamp_ = kNoDecodeTimestamp(); 212 last_appended_buffer_timestamp_ = kNoDecodeTimestamp();
213 last_appended_buffer_is_keyframe_ = false; 213 last_appended_buffer_is_keyframe_ = false;
214 DVLOG(3) << __FUNCTION__ << " next appended buffers will be in a new range"; 214 DVLOG(3) << __FUNCTION__ << " next appended buffers will be in a new range";
215 } else if (last_range != ranges_.end()) { 215 } else if (last_range != ranges_.end()) {
216 DCHECK(last_range == range_for_next_append_); 216 DCHECK(last_range == range_for_next_append_);
217 DVLOG(3) << __FUNCTION__ << " next appended buffers will continue range " 217 DVLOG(3) << __FUNCTION__ << " next appended buffers will continue range "
218 << "unless intervening remove makes discontinuity"; 218 << "unless intervening remove makes discontinuity";
219 } 219 }
220 } 220 }
221 221
222 static std::string BufferQueueToLogString(
wolenetz 2015/07/30 18:55:15 nit: s/static/...move to anonymous namespace at th
servolk 2015/07/30 19:46:16 Done.
223 const SourceBufferStream::BufferQueue& buffers) {
224 std::stringstream result;
225 if (buffers.front()->GetDecodeTimestamp().InMicroseconds() ==
226 buffers.front()->timestamp().InMicroseconds() &&
227 buffers.back()->GetDecodeTimestamp().InMicroseconds() ==
228 buffers.back()->timestamp().InMicroseconds()) {
229 result << "dts/pts=[" << buffers.front()->timestamp().InSecondsF() << ";"
230 << buffers.back()->timestamp().InSecondsF() << "(last frame dur="
231 << buffers.back()->duration().InSecondsF() << ")]";
232 } else {
233 result << "dts=[" << buffers.front()->GetDecodeTimestamp().InSecondsF()
234 << ";" << buffers.back()->GetDecodeTimestamp().InSecondsF()
235 << "] pts=[" << buffers.front()->timestamp().InSecondsF() << ";"
236 << buffers.back()->timestamp().InSecondsF() << "(last frame dur="
237 << buffers.back()->duration().InSecondsF() << ")]";
238 }
239 return result.str();
240 }
241
222 bool SourceBufferStream::Append(const BufferQueue& buffers) { 242 bool SourceBufferStream::Append(const BufferQueue& buffers) {
223 TRACE_EVENT2("media", "SourceBufferStream::Append", 243 TRACE_EVENT2("media", "SourceBufferStream::Append",
224 "stream type", GetStreamTypeName(), 244 "stream type", GetStreamTypeName(),
225 "buffers to append", buffers.size()); 245 "buffers to append", buffers.size());
226 246
227 DCHECK(!buffers.empty()); 247 DCHECK(!buffers.empty());
228 DCHECK(media_segment_start_time_ != kNoDecodeTimestamp()); 248 DCHECK(media_segment_start_time_ != kNoDecodeTimestamp());
229 DCHECK(media_segment_start_time_ <= buffers.front()->GetDecodeTimestamp()); 249 DCHECK(media_segment_start_time_ <= buffers.front()->GetDecodeTimestamp());
230 DCHECK(!end_of_stream_); 250 DCHECK(!end_of_stream_);
231 251
232 DVLOG(1) << __FUNCTION__ << " " << GetStreamTypeName() << ": buffers dts=[" 252 DVLOG(1) << __FUNCTION__ << " " << GetStreamTypeName()
233 << buffers.front()->GetDecodeTimestamp().InSecondsF() << ";" 253 << ": buffers " << BufferQueueToLogString(buffers);
234 << buffers.back()->GetDecodeTimestamp().InSecondsF() << "] pts=["
235 << buffers.front()->timestamp().InSecondsF() << ";"
236 << buffers.back()->timestamp().InSecondsF() << "(last frame dur="
237 << buffers.back()->duration().InSecondsF() << ")]";
238 254
239 // New media segments must begin with a keyframe. 255 // New media segments must begin with a keyframe.
240 // TODO(wolenetz): Relax this requirement. See http://crbug.com/229412. 256 // TODO(wolenetz): Relax this requirement. See http://crbug.com/229412.
241 if (new_media_segment_ && !buffers.front()->is_key_frame()) { 257 if (new_media_segment_ && !buffers.front()->is_key_frame()) {
242 MEDIA_LOG(ERROR, media_log_) << "Media segment did not begin with key " 258 MEDIA_LOG(ERROR, media_log_) << "Media segment did not begin with key "
243 "frame. Support for such segments will be " 259 "frame. Support for such segments will be "
244 "available in a future version. Please see " 260 "available in a future version. Please see "
245 "https://crbug.com/229412."; 261 "https://crbug.com/229412.";
246 return false; 262 return false;
247 } 263 }
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 return false; 1667 return false;
1652 1668
1653 DCHECK_NE(have_splice_buffers, have_preroll_buffer); 1669 DCHECK_NE(have_splice_buffers, have_preroll_buffer);
1654 splice_buffers_index_ = 0; 1670 splice_buffers_index_ = 0;
1655 pending_buffer_.swap(*out_buffer); 1671 pending_buffer_.swap(*out_buffer);
1656 pending_buffers_complete_ = false; 1672 pending_buffers_complete_ = false;
1657 return true; 1673 return true;
1658 } 1674 }
1659 1675
1660 } // namespace media 1676 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698