blob: e1aab8cc22f1d5b1302182fc4836e6aaf1e070b3 [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
Jonas Olssona4d87372019-07-05 19:08:33 +020010#include "rtc_base/stream.h"
11
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000012#include <errno.h>
Yves Gerey988cc082018-10-23 12:03:01 +020013#include <string.h>
Jonas Olssona4d87372019-07-05 19:08:33 +020014
andresp@webrtc.orgff689be2015-02-12 11:54:26 +000015#include <algorithm>
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000016#include <string>
andresp@webrtc.orgff689be2015-02-12 11:54:26 +000017
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "rtc_base/checks.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "rtc_base/thread.h"
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000020
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000021namespace rtc {
22
23///////////////////////////////////////////////////////////////////////////////
24// StreamInterface
25///////////////////////////////////////////////////////////////////////////////
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000026
Yves Gerey665174f2018-06-19 15:03:05 +020027StreamResult StreamInterface::WriteAll(const void* data,
28 size_t data_len,
29 size_t* written,
30 int* error) {
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000031 StreamResult result = SR_SUCCESS;
32 size_t total_written = 0, current_written;
33 while (total_written < data_len) {
34 result = Write(static_cast<const char*>(data) + total_written,
35 data_len - total_written, &current_written, error);
36 if (result != SR_SUCCESS)
37 break;
38 total_written += current_written;
39 }
40 if (written)
41 *written = total_written;
42 return result;
43}
44
kwiberg@webrtc.org67186fe2015-03-09 22:21:53 +000045bool StreamInterface::Flush() {
46 return false;
47}
48
Yves Gerey665174f2018-06-19 15:03:05 +020049StreamInterface::StreamInterface() {}
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000050
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000051} // namespace rtc