summaryrefslogtreecommitdiffstats
path: root/media/mtransport/nricectxhandler.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /media/mtransport/nricectxhandler.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'media/mtransport/nricectxhandler.h')
-rw-r--r--media/mtransport/nricectxhandler.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/media/mtransport/nricectxhandler.h b/media/mtransport/nricectxhandler.h
new file mode 100644
index 000000000..492a19ccf
--- /dev/null
+++ b/media/mtransport/nricectxhandler.h
@@ -0,0 +1,52 @@
+#ifndef nricectxhandler_h__
+#define nricectxhandler_h__
+
+#include "nricectx.h"
+
+namespace mozilla {
+
+class NrIceCtxHandler {
+public:
+ // TODO(ekr@rtfm.com): Too many bools here. Bug 1193437.
+ static RefPtr<NrIceCtxHandler> Create(const std::string& name,
+ bool offerer,
+ bool allow_loopback = false,
+ bool tcp_enabled = true,
+ bool allow_link_local = false,
+ NrIceCtx::Policy policy =
+ NrIceCtx::ICE_POLICY_ALL);
+
+ RefPtr<NrIceMediaStream> CreateStream(const std::string& name,
+ int components);
+ // CreateCtx is necessary so we can create and initialize the context
+ // on main thread, but begin the ice restart mechanics on STS thread
+ RefPtr<NrIceCtx> CreateCtx() const; // for test
+ RefPtr<NrIceCtx> CreateCtx(const std::string& ufrag,
+ const std::string& pwd) const;
+
+ RefPtr<NrIceCtx> ctx() { return current_ctx; }
+
+ bool BeginIceRestart(RefPtr<NrIceCtx> new_ctx);
+ bool IsRestarting() const { return (old_ctx != nullptr); }
+ void FinalizeIceRestart();
+ void RollbackIceRestart();
+
+
+ NS_INLINE_DECL_THREADSAFE_REFCOUNTING(NrIceCtxHandler)
+
+private:
+ NrIceCtxHandler(const std::string& name,
+ bool offerer,
+ NrIceCtx::Policy policy);
+ NrIceCtxHandler() = delete;
+ ~NrIceCtxHandler() {}
+ DISALLOW_COPY_ASSIGN(NrIceCtxHandler);
+
+ RefPtr<NrIceCtx> current_ctx;
+ RefPtr<NrIceCtx> old_ctx; // for while restart is in progress
+ int restart_count; // used to differentiate streams between restarted ctx
+};
+
+} // close namespace
+
+#endif // nricectxhandler_h__