Delete unused function rtc::Flow.
Bug: webrtc:6424 Change-Id: I899398adc8928b784241b2e69f36dce79f9e56f6 Reviewed-on: https://webrtc-review.googlesource.com/c/106904 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25423}
This commit is contained in:
parent
42b43157a4
commit
946179c5da
@ -752,68 +752,4 @@ StreamResult FifoBuffer::WriteOffsetLocked(const void* buffer,
|
||||
return SR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
StreamResult Flow(StreamInterface* source,
|
||||
char* buffer,
|
||||
size_t buffer_len,
|
||||
StreamInterface* sink,
|
||||
size_t* data_len /* = nullptr */) {
|
||||
RTC_DCHECK(buffer_len > 0);
|
||||
|
||||
StreamResult result;
|
||||
size_t count, read_pos, write_pos;
|
||||
if (data_len) {
|
||||
read_pos = *data_len;
|
||||
} else {
|
||||
read_pos = 0;
|
||||
}
|
||||
|
||||
bool end_of_stream = false;
|
||||
do {
|
||||
// Read until buffer is full, end of stream, or error
|
||||
while (!end_of_stream && (read_pos < buffer_len)) {
|
||||
result = source->Read(buffer + read_pos, buffer_len - read_pos, &count,
|
||||
nullptr);
|
||||
if (result == SR_EOS) {
|
||||
end_of_stream = true;
|
||||
} else if (result != SR_SUCCESS) {
|
||||
if (data_len) {
|
||||
*data_len = read_pos;
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
read_pos += count;
|
||||
}
|
||||
}
|
||||
|
||||
// Write until buffer is empty, or error (including end of stream)
|
||||
write_pos = 0;
|
||||
while (write_pos < read_pos) {
|
||||
result = sink->Write(buffer + write_pos, read_pos - write_pos, &count,
|
||||
nullptr);
|
||||
if (result != SR_SUCCESS) {
|
||||
if (data_len) {
|
||||
*data_len = read_pos - write_pos;
|
||||
if (write_pos > 0) {
|
||||
memmove(buffer, buffer + write_pos, *data_len);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
write_pos += count;
|
||||
}
|
||||
|
||||
read_pos = 0;
|
||||
} while (!end_of_stream);
|
||||
|
||||
if (data_len) {
|
||||
*data_len = 0;
|
||||
}
|
||||
return SR_SUCCESS;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
@ -494,25 +494,6 @@ class FifoBuffer : public StreamInterface {
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(FifoBuffer);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Flow attempts to move bytes from source to sink via buffer of size
|
||||
// buffer_len. The function returns SR_SUCCESS when source reaches
|
||||
// end-of-stream (returns SR_EOS), and all the data has been written successful
|
||||
// to sink. Alternately, if source returns SR_BLOCK or SR_ERROR, or if sink
|
||||
// returns SR_BLOCK, SR_ERROR, or SR_EOS, then the function immediately returns
|
||||
// with the unexpected StreamResult value.
|
||||
// data_len is the length of the valid data in buffer. in case of error
|
||||
// this is the data that read from source but can't move to destination.
|
||||
// as a pass in parameter, it indicates data in buffer that should move to sink
|
||||
StreamResult Flow(StreamInterface* source,
|
||||
char* buffer,
|
||||
size_t buffer_len,
|
||||
StreamInterface* sink,
|
||||
size_t* data_len = nullptr);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
#endif // RTC_BASE_STREAM_H_
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user