| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 DCHECK_GE(start, 0); | 101 DCHECK_GE(start, 0); |
| 102 DCHECK_GE(end, 0); | 102 DCHECK_GE(end, 0); |
| 103 demuxer_->Remove(id_, DoubleToTimeDelta(start), DoubleToTimeDelta(end)); | 103 demuxer_->Remove(id_, DoubleToTimeDelta(start), DoubleToTimeDelta(end)); |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool WebSourceBufferImpl::setTimestampOffset(double offset) { | 106 bool WebSourceBufferImpl::setTimestampOffset(double offset) { |
| 107 if (demuxer_->IsParsingMediaSegment(id_)) | 107 if (demuxer_->IsParsingMediaSegment(id_)) |
| 108 return false; | 108 return false; |
| 109 | 109 |
| 110 timestamp_offset_ = DoubleToTimeDelta(offset); | 110 timestamp_offset_ = DoubleToTimeDelta(offset); |
| 111 |
| 112 // http://www.w3.org/TR/media-source/#widl-SourceBuffer-timestampOffset |
| 113 // Step 6: If the mode attribute equals "sequence", then set the group start |
| 114 // timestamp to new timestamp offset. |
| 115 demuxer_->SetGroupStartTimestampIfInSequenceMode(id_, timestamp_offset_); |
| 111 return true; | 116 return true; |
| 112 } | 117 } |
| 113 | 118 |
| 114 void WebSourceBufferImpl::setAppendWindowStart(double start) { | 119 void WebSourceBufferImpl::setAppendWindowStart(double start) { |
| 115 DCHECK_GE(start, 0); | 120 DCHECK_GE(start, 0); |
| 116 append_window_start_ = DoubleToTimeDelta(start); | 121 append_window_start_ = DoubleToTimeDelta(start); |
| 117 } | 122 } |
| 118 | 123 |
| 119 void WebSourceBufferImpl::setAppendWindowEnd(double end) { | 124 void WebSourceBufferImpl::setAppendWindowEnd(double end) { |
| 120 DCHECK_GE(end, 0); | 125 DCHECK_GE(end, 0); |
| 121 append_window_end_ = DoubleToTimeDelta(end); | 126 append_window_end_ = DoubleToTimeDelta(end); |
| 122 } | 127 } |
| 123 | 128 |
| 124 void WebSourceBufferImpl::removedFromMediaSource() { | 129 void WebSourceBufferImpl::removedFromMediaSource() { |
| 125 demuxer_->RemoveId(id_); | 130 demuxer_->RemoveId(id_); |
| 126 demuxer_ = NULL; | 131 demuxer_ = NULL; |
| 127 } | 132 } |
| 128 | 133 |
| 129 } // namespace content | 134 } // namespace content |
| OLD | NEW |