how to send h.264 parameter sets 'out of band' during an ongoing RTP session? - h.264

I am implementing an RTSP server in my application to serve h264 video via RTP. I have read the relevant RFC's and spent a lot of time reading about h264/RTP/RTSP and one point which I am still confused about is how to transmit the 'Sequence Parameter Set' and 'Picture Parameter Set' out of band.
The documentation that I have read states that these should preferably be transmitted via a reliable out-of-band mechanism but I haven't been able to find anything that defines how to transmit them out of band other than using the sprop-parameter-sets attribute of an SDP file.
For instance, RFC 6184 Sectoin 8.4 states:
Parameter set NALUs can be transported using three different
principles:
A. Using a session control protocol (out-of-band) prior to the
actual RTP session.
B. Using a session control protocol (out-of-band) during an ongoing
RTP session.
C. Within the RTP packet stream in the payload (in-band) during an
ongoing RTP session.
...
It is recommended to implement principles A and B within a session
control protocol ...
Section 8.2.2 includes a detailed discussion on transport of
parameter sets in-band or out-of-band in SDP Offer/Answer using media
type parameters sprop-parameter-sets ... This
section contains guidelines on how principles A and B should be
implemented within session control protocols.
...
Parameter sets MAY be added or updated during the lifetime of a
session using principles B and C.
I have read Sections 8.2.2 and 8.4 and cannot find any description of how to implement method 'B'. Everything that I have read on this topic is incredibly vauge, for instance, Wikipedia has the following to say on the subject:
In other applications, it can be advantageous to convey the parameter sets "out-of-band" using a more reliable transport mechanism than the video channel itself.
What am I missing here? Is there some other standard for transmitting this via RTSP? RTCP?

Related

Sending continuous data over HTTP with Go

I am currently working on a web service in Go that essentially takes a request and sends back JSON, rather typical. However, this particular JSON takes 10+ seconds to actually complete and return. Because I am also making a website that depends on the JSON, and the JSON contents are subject to change, I implemented a route that quickly generates and returns (potentially updated or new) names as placeholders that would get replaced later by real values that correspond to the names. The whole idea behind that is the website would connect to the service, get back JSON almost immediately to populate a table, then wait until the actual data to fill in came back from the service.
This is where I encounter an issue, potentially because I am newish to Go and don't understand its vast libraries completely. The previous method that I used to send JSON back through the HTTP requests was ResponseWriter.Write(theJSON). However, Write() terminates the response, so the website would have to continually ping the service which could now and will be disastrous in the future
So, I am seeking some industry knowledge into my issue. Can HTTP connections be continuous like that, where data is sent piecewise through the same http request? Is that even a computationally or security smart feature, or are there better ways to do what I am proposing? Finally, does Go even support a feature like that, and how would I asynchronously handle it for performance optimization?
For the record, my website is using React.js.
i would use https websockets to achieve this effect rather than a long persisting tcp.con or even in addition to this. see the golang.org/x/net/websocket package from the go developers or the excellent http://www.gorillatoolkit.org/pkg/websocket from gorilla web toolkit for use details. You might use padding and smaller subunits to allow interruption and restart of submission // or a kind of diff protocol to rewrite previously submitted JSON. i found websocket pretty stable even with small connection breakdowns.
Go does have a keep alive ability net.TCPConn's SetKeepAlive
kaConn, _ := tcpkeepalive.EnableKeepAlive(conn)
kaConn.SetKeepAliveIdle(30*time.Second)
kaConn.SetKeepAliveCount(4)
kaConn.SetKeepAliveInterval(5*time.Second)
Code from felixqe
You can use restapi as webservice and can sent data as a json.SO you can continously sent data over a communication channel.

Is the JSON-RPC protocol independent?

To achieve bidirectional communication between server and client I've designed a simple protocol over JSON (looks like this).
The idea was to have such layers:
Hardware level – system specific
Messaging level – some arbitrary library handles the hardware level to deliver and receive string messages
The MyJSONLibrary level – uses library to call an RPC or request resource and get response
Application level
Until I found out JSON-RPC exists, I've had a feeling I'm reinventing the wheel.
But seems like JSON-RPC has the layers 2 and 3 combined together, so I can't get a realization for languages L1 and L2, and implement transports for tools A, B, or C. For example, I would like to have python and C# realizations, combined with ZeroMQ library as a transport (layer 2), or with websocket transport. Both of tools allow to deliver and receive messages, so the library uses them. Or UDP, or basic HTTP.
The question is: does JSON-RPC have the layers 2 and 3 combined together? If it is, is there alternatives like I want, or I'd have to stick to my own realizations?
I assume you are referring to the Transport layer by "layer 2" and JAX-RPC runtime by "layer 3".
Quoting from this changelog from JSON-RPC 2.0 (which is linked in the official specifications).
Transport independence [of JSON-RPC 2.0]
JSON-RPC 2.0 doesn't define any transport-specific issues, since transport and RPC are independent.
V1.0 defined that exceptions must be raised if the connection is closed, and that invalid requests/responses must close the connection (and raise exceptions).
In fact if you read the specifications1 you'll find nothing about transport.
JSON-RPC can be over any transport layer.
If you want to use an existing library to implement the runtime, according to Wikipedia, most implementations use HTTP or plain TCP/IP2.
The process of finding the most suited runtime is tedious and unfortunately I haven't worked with any of them, but since most are open source and tiny3, it should't be hard to plug in a new transport layer.
Also since both C# and Python4 have support for parsing JSON, WebSocket and Socket, reimplementing a minimal JSON-RPC runtime should be a matter of a couple of days at most.
1Which I strongly encourage to do as they are very concise and simple.
2Phobos is a C++ implementation that abstract the transport layer.
3For C# JayRock may be promising for customization.
4Not sure about Python.

reliability of spring integration esb

How the reliability of message transmission be protected in the spring intergration?
For example, the server crashed when messages transforming in the router, or messages were processed failed in splitter and transformer?
How the mechanism handles those situation?Is there any references or documents?
Any help will be appreciated!
Also, if your entry point is a channel adapter or gateway that supports transactions (e.g. JMS, AMQP, JDBC, JPA,..) and you use default channels, the entire flow will take place within the scope of that transaction, as the transaction context is bound to the thread. If you add any buffering channels or a downstream aggregator, then you would want to consider what Gary mentioned so that you are actually completing the initial transaction by handing responsibility to another reliable resource (as opposed to leaving a Message in an in-memory Map and then committing, for example).
Hope that makes sense.
Shameless plug: there's a good overview of transactions within the Spring Integration in Action book, available now through MEAP: http://manning.com/fisher/
Regards,
Mark
By default, messages are held in memory but you can declare channels to be persistent, as needed. Persistent channels use JMS, AMQP (rabbit), or a message store. A number of message stores are provided, including JDBC, MongoDB, Redis, or you can construct one that uses a technology of your choice.
http://static.springsource.org/spring-integration/docs/2.1.1.RELEASE/reference/html/

Why use XML(SOAP) when JSON so simple and easy to handle?

Receiving and sending data with JSON is done with simple HTTP requests. Whereas in SOAP, we need to take care of a lot of things. Parsing XML is also, sometimes, hard. Even Facebook uses JSON in Graph API. I still wonder why one should still use SOAP? Is there any reason or area where SOAP is still a better option? (Despite the data format)
Also, in simple client-server apps (like Mobile apps connected with a server), can SOAP give any advantage over JSON?
I will be very thankful if someone can enlist the major/prominent differences between JSON and SOAP considering the information I have provided(If there are any).
I found the following on advantages of SOAP:
There is one big reason everyone sticks with SOAP instead of using JSON. With every JSON setup, you're always coming up with your own data structure for each project. I don't mean how the data is encoded and passed, but how the data formatted format is defined, the data model.
SOAP has an industry-mature way of specifying that data will be in a certain format: e.g. "Cart is a collection of Products and each Product can have these attributes, etc." A well put together WSDL document really has this nailed. See W3C specification: Web Services Description Language
JSON has similar ways of specifying this data structure — a JavaScript class comes to mind as the most common way of doing this — but a JavaScript class isn't really a data structure used for this purpose in any kind of agnostic, well established, widely used way.
In short, SOAP has a way of specifying the data structure in a maturely formatted document (WSDL). JSON doesn't have a standard way of doing this.
If you are creating a client application and your server implementation is done with SOAP then you have to use SOAP in client side.
Also, see: Why use SOAP over JSON and custom data format in an “ENTERPRISE” application? [closed]
Nowadays SOAP is a complete overkill, IMHO. It was nice to use it, nice to learn it, and it is beautiful we can use JSON now.
The only difference between SOAP and REST services (no matter whether using JSON) is that SOAP WS always has it's own WSDL document that could be easily transformed into a self-descriptive documentation while within REST you have to write the documentation for yourself (at least to document the data structures). Here are my cons'&'pros for both:
REST
Pros
lightweight (in all means: no server- nor client-side extensions needed, no big chunks of XML are needed to be transfered here and there)
free choice of the data format - it's up on you to decide whether you can use plain TXT, JSON, XML, or even create you own format of data
most of the current data formats (and even if used XML) ensures that only the really required amount of data is transfered over HTTP while with SOAP for 5 bytes of data you need 1 kB of XML junk (exaggerated, ofc, but you got the point)
Cons
even there are tools that could generate the documentation from docblock comments there is need to write such comments in very descriptive way if one wants to achieve a good documentation as well
SOAP
Pros
has a WSDL that could be generated from even basic docblock comments (in many languages even without them) that works well as a documentation
even there are tools that could work with WSDL to give an enhanced try this request interface (while I do not know about any such tool for REST)
strict data structure
Cons
strict data structure
uses an XML (only!) for data transfers while each request contains a lot of junk and the response contains five times more junk of information
the need for external libraries (for client and/or server, though nowadays there are such libraries already a native part of many languages yet people always tend to use some third-party ones)
To conclude, I do not see a big reason to prefer SOAP over REST (and JSON). Both can do the same, there is a native support for JSON encoding and decoding in almost every popular web programming language and with JSON you have more freedom and the HTTP transfers are cleansed from lot of useless information junk. If I were to build any API now I would use REST with JSON.
I disagree a bit on the trend of JSON I see here. Although JSON is an order maginitude easier, I'd venture to say it's quite limited. For example, SOAP WS is not the last thing. Indeed, between soap client/server you now have enterprise services bus, authentification scheme based on crypto, user management, timestamping requests/replies, etc. For all of this, there're some huge software platforms that provide services around SOAP (well, "web services") and will inject stuff in your XML. So although JSON is probably enough for small projects and an order of magnitude easier there, I think it becomes quite limited if you have decoupled transmission control and content (ie. you develop the content stuff, the actual server, but all the transmission is managed by another team, the authentification by one more team, deployment by yet another team). I don't know if my experience at a big corp is relevant, but I'd say that JSON won't survive there. There are too many constraints on top of the basic need of data representation. So the problem is not JSON RPC itself, the problem is it misses the additional tools to manage the complexity that arises in complex applications (not to say that what you do is not complex, it's just that the software reflects the complexity of the company that produces it)
I think there is a lot of basic misinformation on this thread. SOAP, REST, XML, and JSON concepts seem to be mixed up in the responses.
Here is some clarification -
XML and JSON (an others) are encodings of information.
SOAP is a communications protocol
REST is an (Architecture) style
each is used for something different although you might use more than one of these things together.
Lets start with encoding data structures as XML vs JSON:
Everything JSON currently supports can be done in XML, but not the other way around. JSON will eventually adopt all the features that XML has, but its proponents haven't encountered all of the problems yet, once they get more experience things will be added on to close the gap. for example JSON didn't start out with Schemas and binary formats.
SOAP is a communication protocol for calling an operation. It runs on top of things like, HTTP, SMTP, etc. Aside from many other features, SOAP messages can span multiple "application" layer protocols. i.e. i can sent a SOAP message by HTTP to a service endpoint which then puts it on a message queue for another system. SOAP solves the problem of maintaining authentication, message authenticity, etc. as the requested moved between different parts of a distributed system.
JSON and other data formats canbe sent via SOAP. I work with some systems that sent binary fixed-width encoded objects via SOAP, its not a problem.
The analogy is that - if only the postman is allowed to send you a letter, then it is just HTTP, but if anyone can send you a letter, then you want SOAP. (i.e. message transport security vs message content security)
the 6 REST constraints are architectural style. Interestingly the first several years of REST the examples were in SOAP. (there is no such thing as REST or SOAP they are not opposites)
A "heavyweight bloated, etc.etc." SOA SOAP system might have monoliths with operations like GET, PUT, POST instances of a single entity. SOAP doesn't have those operations predefined, but that is typically how it is used.
Consider that if you built a "REST" service on HTTP alone with an SSL/TLS terminating proxy, then you may have violated the 4th constraint of REST.
So for your software development today, you wouldn't normally interact with any of these directly. Just as if you were written a graphics program you wouldn't directly work with HDMI vs. DisplayPort typically.
The question is do you understand architecturally what your system needs to do and configure it to use the mechanism that does that job. (for example, all the challenges of applying today's microservices to general systems are old problems previously solved by SOAP, CORBA and the old protocols)
I have spent several years writing SOAP web services (with JAX WS). They are not hard to write. And I love the idea of a single endpoint and single HTTP method (POST). For me, REST is too verbose.
But as a data container, JSON is simpler, smaller, more readable, more flexible, looks closer to programming languages.
So, I reinvented the wheel and created my own approach to writing backends for AJAX requests. In comparison:
REST:
get user: method GET https://example.com/users/{id}
update user: method POST https://example.com/users/ (JSON with User object in request body)
RPC:
get user: method GET https://example.com/getUser?id=1
update user: method POST https://example.com/updateUser (JSON with User object in the request body)
My way (the proposed name is JOH - JSON over HTTP):
get user: method POST https://example.com/ (JSON specifies both user ID and class/method responsible for handling request)
update user: method POST https://example.com/ (JSON specifies both user object and class/method responsible for handling request)

What is the exact use of JSON?

Hi i recently found that JSON is been used in many areas. In COMET techniques and as well as in Google instant. Wiki says that:
JSON (an acronym for JavaScript Object
Notation pronounced /ˈdʒeɪsən/) is a
lightweight text-based open standard
designed for human-readable data
interchange....
I was shocked after seeing the word's human-readable data interchange, and I was thinking: since the whole internet is using techniques to increase their security, then why such JSON techniques should be used to exchange data's, since any human eye can see and can read too?
Or else, JSON is very secure, then how?
And if my thought is incorrect then correct me.
If a binary format were used, it wouldn't provide any advantage in security (since it would still be machine-readable and open-spec'd - otherwise it wouldn't have any use for information exchange), and it would make debugging more complicated.
Security is not achieved by the obscurity of interchange formats, but with cryptography. Once you are on an SSL tunnel, you can send the data in whatever format you like most - JSON included - and it will be secure.
Notice that the same applies to any other communication on the web: even HTML is "almost" human readable, and still it's used even for very private communications (e.g. home banking, ...) by encrypting it while it's on the untrusted path with HTTPS.
JSON data is used to put information on a web page. It is human-readable because Web pages are meant to be readable by humans. Web pages are also, by their nature, not secure on the client side, so developers who need to hide certain information either process that on the server or use a secure session.