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 "media/blink/websourcebuffer_impl.h" | 5 #include "media/blink/websourcebuffer_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 // Coded frame processing may update the timestamp offset. If the caller | 104 // Coded frame processing may update the timestamp offset. If the caller |
105 // provides a non-NULL |timestamp_offset| and frame processing changes the | 105 // provides a non-NULL |timestamp_offset| and frame processing changes the |
106 // timestamp offset, report the new offset to the caller. Do not update the | 106 // timestamp offset, report the new offset to the caller. Do not update the |
107 // caller's offset otherwise, to preserve any pre-existing value that may have | 107 // caller's offset otherwise, to preserve any pre-existing value that may have |
108 // more than microsecond precision. | 108 // more than microsecond precision. |
109 if (timestamp_offset && old_offset != timestamp_offset_) | 109 if (timestamp_offset && old_offset != timestamp_offset_) |
110 *timestamp_offset = timestamp_offset_.InSecondsF(); | 110 *timestamp_offset = timestamp_offset_.InSecondsF(); |
111 } | 111 } |
112 | 112 |
| 113 // TODO(servolk): WebSourceBuffer::abort is being renamed into |
| 114 // resetParserState and will be removed soon |
113 void WebSourceBufferImpl::abort() { | 115 void WebSourceBufferImpl::abort() { |
114 demuxer_->Abort(id_, | 116 resetParserState(); |
115 append_window_start_, append_window_end_, | 117 } |
116 ×tamp_offset_); | |
117 | 118 |
118 // TODO(wolenetz): abort should be able to modify the caller timestamp offset | 119 void WebSourceBufferImpl::resetParserState() { |
119 // (just like WebSourceBufferImpl::append). | 120 demuxer_->ResetParserState(id_, |
| 121 append_window_start_, append_window_end_, |
| 122 ×tamp_offset_); |
| 123 |
| 124 // TODO(wolenetz): resetParserState should be able to modify the caller |
| 125 // timestamp offset (just like WebSourceBufferImpl::append). |
120 // See http://crbug.com/370229 for further details. | 126 // See http://crbug.com/370229 for further details. |
121 } | 127 } |
122 | 128 |
123 void WebSourceBufferImpl::remove(double start, double end) { | 129 void WebSourceBufferImpl::remove(double start, double end) { |
124 DCHECK_GE(start, 0); | 130 DCHECK_GE(start, 0); |
125 DCHECK_GE(end, 0); | 131 DCHECK_GE(end, 0); |
126 demuxer_->Remove(id_, DoubleToTimeDelta(start), DoubleToTimeDelta(end)); | 132 demuxer_->Remove(id_, DoubleToTimeDelta(start), DoubleToTimeDelta(end)); |
127 } | 133 } |
128 | 134 |
129 bool WebSourceBufferImpl::setTimestampOffset(double offset) { | 135 bool WebSourceBufferImpl::setTimestampOffset(double offset) { |
(...skipping 24 matching lines...) Expand all Loading... |
154 demuxer_ = NULL; | 160 demuxer_ = NULL; |
155 client_ = NULL; | 161 client_ = NULL; |
156 } | 162 } |
157 | 163 |
158 void WebSourceBufferImpl::InitSegmentReceived() { | 164 void WebSourceBufferImpl::InitSegmentReceived() { |
159 DVLOG(1) << __FUNCTION__; | 165 DVLOG(1) << __FUNCTION__; |
160 client_->initializationSegmentReceived(); | 166 client_->initializationSegmentReceived(); |
161 } | 167 } |
162 | 168 |
163 } // namespace media | 169 } // namespace media |
OLD | NEW |