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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <limits> | 10 #include <limits> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 92 } |
93 | 93 |
94 bool WebSourceBufferImpl::evictCodedFrames(double currentPlaybackTime, | 94 bool WebSourceBufferImpl::evictCodedFrames(double currentPlaybackTime, |
95 size_t newDataSize) { | 95 size_t newDataSize) { |
96 return demuxer_->EvictCodedFrames( | 96 return demuxer_->EvictCodedFrames( |
97 id_, | 97 id_, |
98 base::TimeDelta::FromSecondsD(currentPlaybackTime), | 98 base::TimeDelta::FromSecondsD(currentPlaybackTime), |
99 newDataSize); | 99 newDataSize); |
100 } | 100 } |
101 | 101 |
102 void WebSourceBufferImpl::append( | 102 bool WebSourceBufferImpl::append(const unsigned char* data, |
103 const unsigned char* data, | 103 unsigned length, |
104 unsigned length, | 104 double* timestamp_offset) { |
105 double* timestamp_offset) { | |
106 base::TimeDelta old_offset = timestamp_offset_; | 105 base::TimeDelta old_offset = timestamp_offset_; |
107 demuxer_->AppendData(id_, data, length, append_window_start_, | 106 bool success = demuxer_->AppendData(id_, data, length, append_window_start_, |
108 append_window_end_, ×tamp_offset_); | 107 append_window_end_, ×tamp_offset_); |
109 | 108 |
110 // Coded frame processing may update the timestamp offset. If the caller | 109 // Coded frame processing may update the timestamp offset. If the caller |
111 // provides a non-NULL |timestamp_offset| and frame processing changes the | 110 // provides a non-NULL |timestamp_offset| and frame processing changes the |
112 // timestamp offset, report the new offset to the caller. Do not update the | 111 // timestamp offset, report the new offset to the caller. Do not update the |
113 // caller's offset otherwise, to preserve any pre-existing value that may have | 112 // caller's offset otherwise, to preserve any pre-existing value that may have |
114 // more than microsecond precision. | 113 // more than microsecond precision. |
115 if (timestamp_offset && old_offset != timestamp_offset_) | 114 if (timestamp_offset && old_offset != timestamp_offset_) |
116 *timestamp_offset = timestamp_offset_.InSecondsF(); | 115 *timestamp_offset = timestamp_offset_.InSecondsF(); |
| 116 |
| 117 return success; |
117 } | 118 } |
118 | 119 |
119 void WebSourceBufferImpl::resetParserState() { | 120 void WebSourceBufferImpl::resetParserState() { |
120 demuxer_->ResetParserState(id_, | 121 demuxer_->ResetParserState(id_, |
121 append_window_start_, append_window_end_, | 122 append_window_start_, append_window_end_, |
122 ×tamp_offset_); | 123 ×tamp_offset_); |
123 | 124 |
124 // TODO(wolenetz): resetParserState should be able to modify the caller | 125 // TODO(wolenetz): resetParserState should be able to modify the caller |
125 // timestamp offset (just like WebSourceBufferImpl::append). | 126 // timestamp offset (just like WebSourceBufferImpl::append). |
126 // See http://crbug.com/370229 for further details. | 127 // See http://crbug.com/370229 for further details. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 trackInfo.kind = blink::WebString::fromUTF8(track->kind()); | 188 trackInfo.kind = blink::WebString::fromUTF8(track->kind()); |
188 trackInfo.label = blink::WebString::fromUTF8(track->label()); | 189 trackInfo.label = blink::WebString::fromUTF8(track->label()); |
189 trackInfo.language = blink::WebString::fromUTF8(track->language()); | 190 trackInfo.language = blink::WebString::fromUTF8(track->language()); |
190 trackInfoVector.push_back(trackInfo); | 191 trackInfoVector.push_back(trackInfo); |
191 } | 192 } |
192 | 193 |
193 client_->initializationSegmentReceived(trackInfoVector); | 194 client_->initializationSegmentReceived(trackInfoVector); |
194 } | 195 } |
195 | 196 |
196 } // namespace media | 197 } // namespace media |
OLD | NEW |