Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(684)

Unified Diff: webrtc/stream.h

Issue 1226123005: Define Stream base classes (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Code review follow-up 3 Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/call.h ('k') | webrtc/video/audio_receive_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/stream.h
diff --git a/webrtc/stream.h b/webrtc/stream.h
new file mode 100644
index 0000000000000000000000000000000000000000..fd30571726114a0226e85eba14317922109073c9
--- /dev/null
+++ b/webrtc/stream.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+#ifndef WEBRTC_STREAM_H_
+#define WEBRTC_STREAM_H_
+
+#include "webrtc/common_types.h"
+
+namespace webrtc {
+
+enum NetworkState {
+ kNetworkUp,
+ kNetworkDown,
+};
+
+// Common base class for streams.
+class Stream {
+ public:
+ // Starts stream activity.
+ // When a stream is active, it can receive, process and deliver packets.
+ virtual void Start() = 0;
+ // Stops stream activity.
+ // When a stream is stopped, it can't receive, process or deliver packets.
+ virtual void Stop() = 0;
+ // Called to notify that network state has changed, so that the stream can
+ // respond, e.g. by pausing or resuming activity.
+ virtual void SignalNetworkState(NetworkState state) = 0;
+ // Called when a RTCP packet is received.
+ virtual bool DeliverRtcp(const uint8_t* packet, size_t length) = 0;
+
+ protected:
+ virtual ~Stream() {}
+};
+
+// Common base class for receive streams.
+class ReceiveStream : public Stream {
+ public:
+ // Called when a RTP packet is received.
+ virtual bool DeliverRtp(const uint8_t* packet, size_t length) = 0;
+};
+
+// Common base class for send streams.
+// A tag class that denotes send stream type.
+class SendStream : public Stream {};
+
+} // namespace webrtc
+
+#endif // WEBRTC_STREAM_H_
« no previous file with comments | « webrtc/call.h ('k') | webrtc/video/audio_receive_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698