VNC screen live streaming with GStreamer - encoding

Intro
I've been trying to capture vnc screen with GStreamer and then send it to rtp endpoint. I've already used a rfbsrc plugin, but it works unstable and there are first frames loss and freezing.
Maybe there is an issue in my GStreamer pipeline :
'--gst-debug=2',
'-vvv',
'rtpbin', 'name=rtpbin', 'rtp-profile=avpf', 'latency=100',
'rfbsrc', `host=${rfbConfig.host}`, `port=${rfbConfig.port}`,
'!', 'videoconvert',
'!', 'x264enc', 'tune=zerolatency', 'speed-preset=1', 'dct8x8=true', 'quantizer=23', 'pass=qual',
'!', 'video/x-h264, profile=baseline',
'!', 'rtph264pay', 'ssrc=111110', 'pt=96',
'!', 'queue2',
'!', 'rtprtxqueue', 'max-size-time=2000', 'max-size-packets=0',
'!', 'rtpbin.send_rtp_sink_0',
'rtpbin.send_rtp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', 'bind-port=5004', `port=${videoRtpPort}`,
'rtpbin.send_rtcp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', `port=${videoRtcpPort}`, 'sync=false', 'async=false', 'udpsrc', 'port=5005',
'!', 'rtpbin.recv_rtcp_sink_0',
I'm trying to use another way of capturing - to encode frames from stdin, but actually I've succeeded nothing with the following pipeline:
'--gst-debug=2',
'-vvv',
'rtpbin', 'name=rtpbin', 'rtp-profile=avpf', 'latency=100',
'fdsrc',
'!', 'videoparse', 'width=1280', 'height=720', 'framerate=15/1',
'!', 'queue',
'!', 'x264enc', 'tune=zerolatency', 'speed-preset=1', 'dct8x8=true', 'quantizer=23',
'pass=qual',
'!', 'video/x-h264, profile=baseline',
'!', 'rtph264pay', 'ssrc=111110', 'pt=96',
'!', 'queue2',
'!', 'rtprtxqueue', 'max-size-time=2000', 'max-size-packets=0',
'!', 'rtpbin.send_rtp_sink_0',
'rtpbin.send_rtp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', 'bind-port=5004',
`port=${videoRtpPort}`,
'rtpbin.send_rtcp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', `port=${videoRtcpPort}`,
'sync=false', 'async=false', 'udpsrc', 'port=5005',
'!', 'rtpbin.recv_rtcp_sink_0',
The question
What is the correct way to capture vnc screen with GStreamer and send in to RTP endpoint? Is there any explicit mistake in my GStreamer pipelines?

Finally, I solved the issue with the following pipeline:
'gst-launch-1.0',
'-vvv',
'rtpbin', 'name=rtpbin', 'rtp-profile=avpf',
'fdsrc', 'timeout=1000000',
'!', 'queue', 'max-size-bytes=0', 'max-size-buffers=0', 'max-size-time=0', 'min-threshold-buffers=1',
'!', 'image/x-portable-pixmap,width=1280,height=720,framerate=30/1',
'!', 'pnmdec',
'!', 'videoconvert',
'!', 'x264enc', 'tune=zerolatency', 'speed-preset=1', 'dct8x8=true', 'quantizer=23', 'pass=qual',
'!', 'video/x-h264, profile=baseline',
'!', 'rtph264pay', 'ssrc=111110', 'pt=96',
'!', 'rtprtxqueue', 'max-size-time=2000', 'max-size-packets=0',
'!', 'rtpbin.send_rtp_sink_0',
'rtpbin.send_rtp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', 'bind-port=5004', `port=${videoRtpPort}`,
'rtpbin.send_rtcp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', `port=${videoRtcpPort}`, 'sync=false', 'async=false', 'udpsrc', 'port=5005',
'!', 'rtpbin.recv_rtcp_sink_0',
I used pnmdec to decode raw images got from rfb (vnc).

Related

Rest service Java, error using jersey dependency

I getting started with Java and rest services, i created a rest service with GET method, this method return a UserVO with his properties, im set properties values with random values using setMethods and return object but this not work mapping object to json of jersey. I using tomcat 6, JDK 1.8.0_121 and eclipse and show this error:
com.sun.jersey.spi.container.ContainerResponse write
GRAVE: A message body writer for Java class Autoconsulta.ValueObject.UsuarioVO, and Java type class Autoconsulta.ValueObject.UsuarioVO, and MIME media type application/json was not found.
The registered message body writers compatible with the MIME media type are:
application/json ->
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$App
com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$App
com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$App
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$App
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$App
VO
public class UsuarioVO {
private String rut;
private boolean isValid;
public String getRut() {
return rut;
}
public void setRut(String rut) {
this.rut = rut;
}
public boolean isValid() {
return isValid;
}
public void setValid(boolean isValid) {
this.isValid = isValid;
}
}
my ret service:
#GET
#Path("/getUser")
#Produces({MediaType.APPLICATION_JSON})
public UsuarioVO getUsuario() {
UsuarioVO u = new UsuarioVO();
u.setRut("123444");
u.setValid(true);
return u;
}
web xml
<servlet>
<servlet-name>Servicio_Rest</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>Autoconsulta.ws.rest.service</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Servicio_Rest</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
pom xml
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.19</version>
</dependency>

Real Time Progress bar with a blockUI doesn't work using primefaces with atmosphere

I have a button and when I press on it, the method obtains data from the data base and show the records in a datatable. The action takes more than 1 minute and I want to show a progress bar (the time is variable)
I found the solution in this page:Show a real time progress bar in a Html User Dialog
The problem is that I show the progress bar, but always is "0%". In the javascript function never enter. And I don't know if I'm doing something wrong.
This is my XHTML:
<h:form id="formAllocate">
<p:panel id="panel" header="Realtime ProgressBar">
<p:commandButton id="btn" value="Start"
actionListener="#{scheduleMB.startLongRunningProcess}">
</p:commandButton>
</p:panel>
<p:blockUI block="panel" trigger="btn">
<p:progressBar widgetVar="progressBar" style="width:300px"
labelTemplate="{value}%">
</p:progressBar>
<span id="msg"></span>
</p:blockUI>
</h:form>
<p:socket channel="/realtime" onMessage="handleProgress"></p:socket>
<script type="text/javascript">
function handleProgress(progressJson) {
alert('begin');
var progressData = eval("(" + progressJson + ")");
progressBar.setValue(progressData.progress);
$("#msg").text(progressData.msg);
}
</script>
This is my Bean:
public void startLongRunningProcess(){
EventBus eventBus = EventBusFactory.getDefault().eventBus();
eventBus.publish("/realtime", "{ 'progress' : 10, 'msg' : 'Extract data'}");
list =
getAuxService().findList(userSelected, initDate2,
endDate2);
}
In the web.xml:
<!-- Primefaces PUSH -->
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.primefaces.push.PushServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/primepush/*</url-pattern>
</servlet-mapping>
In my pom.xml I have this dependencies:
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.roboguice</groupId>
<artifactId>roboguice</artifactId>
<version>2.0</version>
</dependency>
I'm using primefaces 5.1, spring 3.2.5, hibernate 4.2.7, java 1.7, primefaces extension 3.0.0
What I'm doing wrong???
Thx for the help and answer.
The answer to this (by me) can be found in the (duplicate) post in the PrimeFaces forum
Summary:
#PushEndpoint was missing
4.0 to 5.0 mirgration guide was not followed for the access of the PF widget (widgetName -> PF('widgetName))
OP did not know that the increments in the progressbar were to be set each time by publishing an event each time

#NotNull annotation is not checking null queryparameter in Jersey REST resource

I am trying to use javax.validation.validation-api for validating #QueryParam parameters. I have followed steps as below:
Added dependency:
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-bean-validation</artifactId>
<version>2.12</version>
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</exclusion>
</exclusions>
</dependency>
Jersey resource:
#GET
#Produces(MediaType.APPLICATION_JSON)
#Path("/{param1}")
#ValidateOnExecution
public SomeObject get(#PathParam("param1") String param1,
#NotNull #QueryParam("q1") String q1,
#NotNull #QueryParam("q2") String q2) {
try {
//Assuming q1 and q2 are NOT Null here
...
} catch(Exception exception) {
throw new WebApplicationException(exception,
Response.Status.INTERNAL_SERVER_ERROR);
}
return someObject;
}
I tried giving various combination of URLs as in q1 and q2 both parameters absent, q1 absent or q2 absent. Each time, #NotNull is not getting detected. Means try block code is getting executed irrespective of q1 and q2 being null.
What else needs to be done?
I referred this link - https://jersey.java.net/documentation/latest/bean-validation.html#d0e11956.
How to check Auto-Discoverable feature is on in my environment?

A seemingly aged lift exception: Message: scala.MatchError: null on ScalaRunTime.scala:136

Message: scala.MatchError: null
scala.runtime.ScalaRunTime$.boxArray(ScalaRunTime.scala:136)
net.liftweb.http.Req$$anonfun$16.apply(Req.scala:374)
net.liftweb.http.LiftMerge$class.fixAttrs$1(LiftMerge.scala:98)
net.liftweb.http.LiftMerge$class.fixAttrs$1(LiftMerge.scala:99)
net.liftweb.http.LiftMerge$class.fixAttrs$1(LiftMerge.scala:99)
net.liftweb.http.LiftMerge$class.fixAttrs$1(LiftMerge.scala:99)
net.liftweb.http.LiftMerge$class.fixAttrs$1(LiftMerge.scala:99)
net.liftweb.http.LiftMerge$class.fixAttrs$1(LiftMerge.scala:99)
net.liftweb.http.LiftMerge$$anonfun$_fixHtml$1$1.apply(LiftMerge.scala:151)
net.liftweb.http.LiftMerge$$anonfun$_fixHtml$1$1.apply(LiftMerge.scala:105)
scala.Seq$class.flatMap(Seq.scala:294)
scala.xml.NodeSeq.flatMap(NodeSeq.scala:34)
net.liftweb.http.LiftMerge$class._fixHtml$1(LiftMerge.scala:104)
net.liftweb.http.LiftMerge$$anonfun$_fixHtml$1$1.apply(LiftMerge.scala:151)
net.liftweb.http.LiftMerge$$anonfun$_fixHtml$1$1.apply(LiftMerge.scala:105)
scala.Seq$class.flatMap(Seq.scala:294)
I found a thread here that looks like it: http://groups.google.com/group/liftweb/tree/browse_frm/month/2009-12/b5a053497a5977af?rnum=31&_done=%2Fgroup%2Fliftweb%2Fbrowse_frm%2Fmonth%2F2009-12%3F
But my version is relatively new already. How come it's still happening?
Here comes my lift setting in maven:
<dependency>
<groupId>net.liftweb</groupId>
<artifactId>lift-mapper</artifactId>
<version>2.0</version>
</dependency>
I don't have any clue here :(

How to implement the iAds in xcode 3.1.3 [duplicate]

This question already has answers here:
How to work with iAds using xcode 3.1.3
(2 answers)
Closed 9 years ago.
In iPhone Programmer presently I am working with iAds in xcode 3.1.3 but in my Project this kind of errors are occurred. please tell me it is possible to work in iAds in xcode 3.1.3?
My error is
ADBannerView.h:88: error: expected ')' before 'ADBannerView'
ADBannerView.h:97: error: expected ')' before 'ADBannerView'
ADBannerView.h:102: error: expected ')' before 'ADBannerView'
ADBannerView.h:110: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_4_2'
ADBannerView.h:111: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_4_2'
ADBannerView.h:112: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__AVAILABILITY_INTERNAL__IPHONE_4_2'
ADBannerView.h:113: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__AVAILABILITY_INTERNAL__IPHONE_4_2'
/Users/girishramdas/Desktop/iAds sample/iAdSuite/BasicAdBanner/Classes/TextViewController.h:59: error: expected specifier-qualifier-list before 'ADBannerView'
Make sure you have error handeling for if an ad cannot be displayed. If you dont have this it may cause a crash like this.
something like:
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
if (self.bannerIsVisible) {
/* set banner not visible here
}
This one has explained the step by step implementation of iAds...