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

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: Moved BufferQueueToLogString to anonymous namespace 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 std::stringstream ss; 83 std::stringstream ss;
84 for (const auto* range_ptr : ranges) { 84 for (const auto* range_ptr : ranges) {
85 if (range_ptr != ranges.front()) 85 if (range_ptr != ranges.front())
86 ss << " "; 86 ss << " ";
87 ss << RangeToString(*range_ptr); 87 ss << RangeToString(*range_ptr);
88 } 88 }
89 return ss.str(); 89 return ss.str();
90 } 90 }
91 91
92 std::string BufferQueueToLogString(
93 const SourceBufferStream::BufferQueue& buffers) {
94 std::stringstream result;
95 if (buffers.front()->GetDecodeTimestamp().InMicroseconds() ==
96 buffers.front()->timestamp().InMicroseconds() &&
97 buffers.back()->GetDecodeTimestamp().InMicroseconds() ==
98 buffers.back()->timestamp().InMicroseconds()) {
99 result << "dts/pts=[" << buffers.front()->timestamp().InSecondsF() << ";"
100 << buffers.back()->timestamp().InSecondsF() << "(last frame dur="
101 << buffers.back()->duration().InSecondsF() << ")]";
102 } else {
103 result << "dts=[" << buffers.front()->GetDecodeTimestamp().InSecondsF()
104 << ";" << buffers.back()->GetDecodeTimestamp().InSecondsF()
105 << "] pts=[" << buffers.front()->timestamp().InSecondsF() << ";"
106 << buffers.back()->timestamp().InSecondsF() << "(last frame dur="
107 << buffers.back()->duration().InSecondsF() << ")]";
108 }
109 return result.str();
110 }
111
92 SourceBufferRange::GapPolicy TypeToGapPolicy(SourceBufferStream::Type type) { 112 SourceBufferRange::GapPolicy TypeToGapPolicy(SourceBufferStream::Type type) {
93 switch (type) { 113 switch (type) {
94 case SourceBufferStream::kAudio: 114 case SourceBufferStream::kAudio:
95 case SourceBufferStream::kVideo: 115 case SourceBufferStream::kVideo:
96 return SourceBufferRange::NO_GAPS_ALLOWED; 116 return SourceBufferRange::NO_GAPS_ALLOWED;
97 case SourceBufferStream::kText: 117 case SourceBufferStream::kText:
98 return SourceBufferRange::ALLOW_GAPS; 118 return SourceBufferRange::ALLOW_GAPS;
99 } 119 }
100 120
101 NOTREACHED(); 121 NOTREACHED();
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
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