OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/websourcebuffer_impl.h" | 5 #include "content/renderer/media/websourcebuffer_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/float_util.h" | 9 #include "base/float_util.h" |
10 #include "media/filters/chunk_demuxer.h" | 10 #include "media/filters/chunk_demuxer.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 DCHECK_GE(start, 0); | 95 DCHECK_GE(start, 0); |
96 DCHECK_GE(end, 0); | 96 DCHECK_GE(end, 0); |
97 demuxer_->Remove(id_, DoubleToTimeDelta(start), DoubleToTimeDelta(end)); | 97 demuxer_->Remove(id_, DoubleToTimeDelta(start), DoubleToTimeDelta(end)); |
98 } | 98 } |
99 | 99 |
100 bool WebSourceBufferImpl::setTimestampOffset(double offset) { | 100 bool WebSourceBufferImpl::setTimestampOffset(double offset) { |
101 if (demuxer_->IsParsingMediaSegment(id_)) | 101 if (demuxer_->IsParsingMediaSegment(id_)) |
102 return false; | 102 return false; |
103 | 103 |
104 timestamp_offset_ = DoubleToTimeDelta(offset); | 104 timestamp_offset_ = DoubleToTimeDelta(offset); |
| 105 |
| 106 // http://www.w3.org/TR/media-source/#widl-SourceBuffer-timestampOffset |
| 107 // Step 6: If the mode attribute equals "sequence", then set the group start |
| 108 // timestamp to new timestamp offset. |
| 109 demuxer_->SetGroupStartTimestampIfInSequenceMode(id_, timestamp_offset_); |
105 return true; | 110 return true; |
106 } | 111 } |
107 | 112 |
108 void WebSourceBufferImpl::setAppendWindowStart(double start) { | 113 void WebSourceBufferImpl::setAppendWindowStart(double start) { |
109 DCHECK_GE(start, 0); | 114 DCHECK_GE(start, 0); |
110 append_window_start_ = DoubleToTimeDelta(start); | 115 append_window_start_ = DoubleToTimeDelta(start); |
111 } | 116 } |
112 | 117 |
113 void WebSourceBufferImpl::setAppendWindowEnd(double end) { | 118 void WebSourceBufferImpl::setAppendWindowEnd(double end) { |
114 DCHECK_GE(end, 0); | 119 DCHECK_GE(end, 0); |
115 append_window_end_ = DoubleToTimeDelta(end); | 120 append_window_end_ = DoubleToTimeDelta(end); |
116 } | 121 } |
117 | 122 |
118 void WebSourceBufferImpl::removedFromMediaSource() { | 123 void WebSourceBufferImpl::removedFromMediaSource() { |
119 demuxer_->RemoveId(id_); | 124 demuxer_->RemoveId(id_); |
120 demuxer_ = NULL; | 125 demuxer_ = NULL; |
121 } | 126 } |
122 | 127 |
123 } // namespace content | 128 } // namespace content |
OLD | NEW |