| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 len_ += subread; | 60 len_ += subread; |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Process buffered data | 64 // Process buffered data |
| 65 size_t in_len = len_; | 65 size_t in_len = len_; |
| 66 size_t out_len = buffer_len; | 66 size_t out_len = buffer_len; |
| 67 StreamResult result = transform_->Transform(buffer_, &in_len, | 67 StreamResult result = transform_->Transform(buffer_, &in_len, |
| 68 buffer, &out_len, | 68 buffer, &out_len, |
| 69 (state_ == ST_FLUSHING)); | 69 (state_ == ST_FLUSHING)); |
| 70 ASSERT(result != SR_BLOCK); | 70 RTC_DCHECK(result != SR_BLOCK); |
| 71 if (result == SR_EOS) { | 71 if (result == SR_EOS) { |
| 72 // Note: Don't signal SR_EOS this iteration, unless out_len is zero | 72 // Note: Don't signal SR_EOS this iteration, unless out_len is zero |
| 73 state_ = ST_COMPLETE; | 73 state_ = ST_COMPLETE; |
| 74 } else if (result == SR_ERROR) { | 74 } else if (result == SR_ERROR) { |
| 75 state_ = ST_ERROR; | 75 state_ = ST_ERROR; |
| 76 error_ = -1; // TODO: propagate error | 76 error_ = -1; // TODO: propagate error |
| 77 break; | 77 break; |
| 78 } else if ((out_len == 0) && (state_ == ST_FLUSHING)) { | 78 } else if ((out_len == 0) && (state_ == ST_FLUSHING)) { |
| 79 // If there is no output AND no more input, then something is wrong | 79 // If there is no output AND no more input, then something is wrong |
| 80 state_ = ST_ERROR; | 80 state_ = ST_ERROR; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 111 return SR_EOS; | 111 return SR_EOS; |
| 112 | 112 |
| 113 if (len_ < sizeof(buffer_)) { | 113 if (len_ < sizeof(buffer_)) { |
| 114 // Process buffered data | 114 // Process buffered data |
| 115 size_t in_len = data_len; | 115 size_t in_len = data_len; |
| 116 size_t out_len = sizeof(buffer_) - len_; | 116 size_t out_len = sizeof(buffer_) - len_; |
| 117 StreamResult result = transform_->Transform(data, &in_len, | 117 StreamResult result = transform_->Transform(data, &in_len, |
| 118 buffer_ + len_, &out_len, | 118 buffer_ + len_, &out_len, |
| 119 (state_ == ST_FLUSHING)); | 119 (state_ == ST_FLUSHING)); |
| 120 | 120 |
| 121 ASSERT(result != SR_BLOCK); | 121 RTC_DCHECK(result != SR_BLOCK); |
| 122 if (result == SR_EOS) { | 122 if (result == SR_EOS) { |
| 123 // Note: Don't signal SR_EOS this iteration, unless no data written | 123 // Note: Don't signal SR_EOS this iteration, unless no data written |
| 124 state_ = ST_COMPLETE; | 124 state_ = ST_COMPLETE; |
| 125 } else if (result == SR_ERROR) { | 125 } else if (result == SR_ERROR) { |
| 126 RTC_NOTREACHED(); // When this happens, think about what should be done | 126 RTC_NOTREACHED(); // When this happens, think about what should be done |
| 127 state_ = ST_ERROR; | 127 state_ = ST_ERROR; |
| 128 error_ = -1; // TODO: propagate error | 128 error_ = -1; // TODO: propagate error |
| 129 break; | 129 break; |
| 130 } | 130 } |
| 131 | 131 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 bool TransformAdapter::ReserveSize(size_t size) { | 190 bool TransformAdapter::ReserveSize(size_t size) { |
| 191 return true; | 191 return true; |
| 192 } | 192 } |
| 193 | 193 |
| 194 bool TransformAdapter::Rewind() { | 194 bool TransformAdapter::Rewind() { |
| 195 return false; | 195 return false; |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace rtc | 198 } // namespace rtc |
| OLD | NEW |