| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Coded frame processing may update the timestamp offset. If the caller | 81 // Coded frame processing may update the timestamp offset. If the caller |
| 82 // provides a non-NULL |timestamp_offset| and frame processing changes the | 82 // provides a non-NULL |timestamp_offset| and frame processing changes the |
| 83 // timestamp offset, report the new offset to the caller. Do not update the | 83 // timestamp offset, report the new offset to the caller. Do not update the |
| 84 // caller's offset otherwise, to preserve any pre-existing value that may have | 84 // caller's offset otherwise, to preserve any pre-existing value that may have |
| 85 // more than microsecond precision. | 85 // more than microsecond precision. |
| 86 if (timestamp_offset && old_offset != timestamp_offset_) | 86 if (timestamp_offset && old_offset != timestamp_offset_) |
| 87 *timestamp_offset = timestamp_offset_.InSecondsF(); | 87 *timestamp_offset = timestamp_offset_.InSecondsF(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void WebSourceBufferImpl::abort() { | 90 void WebSourceBufferImpl::abort() { |
| 91 demuxer_->Abort(id_); | 91 demuxer_->Abort(id_, |
| 92 append_window_start_, append_window_end_, |
| 93 ×tamp_offset_); |
| 94 |
| 95 // TODO(wolenetz): abort should be able to modify the caller timestamp offset |
| 96 // (just like WebSourceBufferImpl::append). |
| 97 // See http://crbug.com/370229 for further details. |
| 92 } | 98 } |
| 93 | 99 |
| 94 void WebSourceBufferImpl::remove(double start, double end) { | 100 void WebSourceBufferImpl::remove(double start, double end) { |
| 95 DCHECK_GE(start, 0); | 101 DCHECK_GE(start, 0); |
| 96 DCHECK_GE(end, 0); | 102 DCHECK_GE(end, 0); |
| 97 demuxer_->Remove(id_, DoubleToTimeDelta(start), DoubleToTimeDelta(end)); | 103 demuxer_->Remove(id_, DoubleToTimeDelta(start), DoubleToTimeDelta(end)); |
| 98 } | 104 } |
| 99 | 105 |
| 100 bool WebSourceBufferImpl::setTimestampOffset(double offset) { | 106 bool WebSourceBufferImpl::setTimestampOffset(double offset) { |
| 101 if (demuxer_->IsParsingMediaSegment(id_)) | 107 if (demuxer_->IsParsingMediaSegment(id_)) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 114 DCHECK_GE(end, 0); | 120 DCHECK_GE(end, 0); |
| 115 append_window_end_ = DoubleToTimeDelta(end); | 121 append_window_end_ = DoubleToTimeDelta(end); |
| 116 } | 122 } |
| 117 | 123 |
| 118 void WebSourceBufferImpl::removedFromMediaSource() { | 124 void WebSourceBufferImpl::removedFromMediaSource() { |
| 119 demuxer_->RemoveId(id_); | 125 demuxer_->RemoveId(id_); |
| 120 demuxer_ = NULL; | 126 demuxer_ = NULL; |
| 121 } | 127 } |
| 122 | 128 |
| 123 } // namespace content | 129 } // namespace content |
| OLD | NEW |