README 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. This is a generic media transport system for WebRTC.
  2. The basic model is that you have a TransportFlow which contains a
  3. series of TransportLayers, each of which gets an opportunity to
  4. manipulate data up and down the stack (think SysV STREAMS or a
  5. standard networking stack). You can also address individual
  6. sublayers to manipulate them or to bypass reading and writing
  7. at an upper layer; WebRTC uses this to implement DTLS-SRTP.
  8. DATAFLOW MODEL
  9. Unlike the existing nsSocket I/O system, this is a push rather
  10. than a pull system. Clients of the interface do writes downward
  11. with SendPacket() and receive notification of incoming packets
  12. via callbacks registed via sigslot.h. It is the responsibility
  13. of the bottom layer (or any other layer which needs to reference
  14. external events) to arrange for that somehow; typically by
  15. using nsITimer or the SocketTansportService.
  16. This sort of push model is a much better fit for the demands
  17. of WebRTC, expecially because ICE contexts span multiple
  18. network transports.
  19. THREADING MODEL
  20. There are no thread locks. It is the responsibility of the caller to
  21. arrange that any given TransportLayer/TransportFlow is only
  22. manipulated in one thread at once. One good way to do this is to run
  23. everything on the STS thread. Many of the existing layer implementations
  24. (TransportLayerPrsock, TransportLayerIce, TransportLayerLoopback)
  25. already run on STS so in those cases you must run on STS, though
  26. you can do setup on the main thread and then activate them on the
  27. STS.
  28. EXISTING TRANSPORT LAYERS
  29. The following transport layers are currently implemented:
  30. * DTLS -- a wrapper around NSS's DTLS [RFC 6347] stack
  31. * ICE -- a wrapper around the nICEr ICE [RFC 5245] stack.
  32. * Prsock -- a wrapper around NSPR sockets
  33. * Loopback -- a loopback IO mechanism
  34. * Logging -- a passthrough that just logs its data
  35. The last three are primarily for debugging.