I only want to send video from an Android WebRTC client. Do I need a GLSurfaceView.Renderer like the one obtained via VideoRendererGui? And if not, then what would you pass for the eglContext part of this:
PeerConnectionFactory.initializeAndroidGlobals(
Object context, boolean initializeAudio, boolean initializeVideo,
boolean vp8HwAcceleration, Object renderEGLContext)
Did you already found a solution ? My use case was similar to your's. I guess, you already explored how VideoCapturerAndroid.java library, specially "startCaptureOnCameraThread" function was implemented in webRTC, and found your solution. Just in case if you still having problems with it; Yes, you can sure escape creating a local egl surface renderer if you don't need to, and can just pass null for the fifth parameter.
I pass null on eglContext. I've checked the value of VideoRendererGui.getEGLContext() and it's null. So if you pass null is not a problem, audio/video/data streaming works great!
Related
I was wondering what the difference between database.getReference("foo/bar/123") and database.getReference("foo").child("bar").child("123") is?
I'm assuming that the later one will load the complete "foo" object whereas database.getReference("foo/bar/123") just loads the "123" object?
Is my assumption correct or what is the correct / most efficient way to only load data of "123"?
The two are equivalent. You can inspect this manually this by printing the toString() format for both References.
References are cheap - there's nothing inefficient about either solution. Neither one has yet loaded any data. A Reference is just a pointer to a location in the database.
It should not make a difference, a reference is not actually accessed when instantiated. This is the most relevant document I can find,
https://firebase.google.com/docs/reference/node/firebase.database.Reference
The docs don't say it explicitly, but requests are only performed when using the .set() or .on() methods
Using the Google Glass GDK, I'm trying to put together a simple app that displays / updates a live card. In my Service, I have the following method:
private void publishCard(Context context) {
Card updatedCard = new Card(context);
updatedCard.setText("Foo");
updatedCard.setInfo("Bar");
RemoteViews cardViews = updatedCard.toRemoteViews();
if (cardViews == null)
Log.e(TAG, "Appears to happen every time!")
// Then do some other stuff that fails because of a null RemoteViews
}
As you can see above, the null check seems to fail every time. Any idea why that might be?
My thought is that I'm calling this and passing in a Service as the context rather than an Activity, and maybe you're not supposed to do that? If that were the case, though, how would you be able to update a Live Card? I am capable of constructing a RemoteViews from an XML, but being able to use a Card would simplify things a lot.
That method is not currently implemented; you can follow issue 268 on our issue tracker if you want to keep track of the progress.
For now, you will have to create your own layout XML and use that to create the RemoteViews.
I'm using Robolectric to test an activity that inflates a custom view, but when fetching values from the TypedArray everything comes back null or an empty string. What needs to be done in order to get the correct value from the typed array?
Robolectric doesn't re-implement the entire Android standard library.
Here is a link to the TypeArray Shadow class:
https://github.com/pivotal/robolectric/blob/master/src/main/java/com/xtremelabs/robolectric/shadows/ShadowTypedArray.java
It seems to be missing some things. You can use this function to confirm that it is indeed missing those functions:
http://pivotal.github.com/robolectric/javadoc/com/xtremelabs/robolectric/Robolectric.html#logMissingInvokedShadowMethods()
That said, there is hope. Robolectric 2.0 Alpha 1 was recently released. While I haven't used it yet, it claims that less shadow implementations will be needed as it will use the Android implementations directly.
Try using getStringArray() instead. For example:
String[] myStringArray = Robolectric.getShadowApplication().getResources()
.getStringArray(R.array.MyStringArrayIdentifier)
OOTB, Robolectric does not support Locales that well. Therefore, if your app is dependent on locales (which a lot of apps are if they are i18n'nd properly) this can be a royal pain. Long story short, I created my own ShadowFooGeocoder and ShadowFooAddress that allow me to simulate the locale I want. They're basically re-implementations of the existing shadows.
However, when I bind my class as such: bindShadowClass(ShadowFooGeocoder.class), this works great. At runtime, the correct shadow is returned. The problem is that I want to set up the simulations on this object and I'm not sure how. shadowOf(instance) where instance is an injected GeoCoder returns ShadowGeoCoder. I've tried working directly with the ShadowWrangler, but that also returns a ShadowGeocoder.
How can I get at my shadowed class that I've bound through the bindShadowClass(...) call so I can set my expectations (simulations)?
Note: This is a repost of the same question on the Robolectric group here. I posted here because my success rate of getting anyone to answer questions on the group is fairly low. I'm hoping for a better result here.
What I've basically done here is extend ShadowGeocoder like this:
#SuppressWarnings({"UnusedDeclaration"})
#Implements(Geocoder.class)
public class ShadowFooBarGeocoder extends ShadowGeocoder {
// implementation stuff
}
Then I would bind it using the bindShadowClasss(...) and when I retreive the shadow via the static shadowOf(...) call I get back a "ShadowGeocoder" which is an instance of ShadowFooBarGeocoder. I then cast it to that type and perform whatever work I need to.
I'm trying to find a way to check to see if a current EGLContext exists and is ready to use on Android. By specification, I've tried using
((EGL10)EGLContext.getEGL()).eglGetCurrentContext()
and then comparing it to EGL10.EGL_NO_CONTEXT (tried .equals() and != ). However, even though through debugging it 'seems' that it is returning an instance of 'EGL_NO_CONTEXT' (seems meaning all the internal values are uninitialized) however no matter what comparison I do I can't get it to work.
Anyone know of another/proper method to get this done? I don't want to do it by throwing a random GL call and catching the EGLError...
I ran into the problem of not being able to re-use the current EGLContext when trying to render what was on screen in a GLSurfaceView to an offscreen EGLPixelBufferSurface. From what I can tell, the problem with using the static method
EGLContext.getEgl()
is that it creates a default EGL instance - this would mean that the EGLContext associated with it is equivalent to EGL10.EGL_NO_CONTEXT.
Also, in Android the EGLContext can only be associated with one thread (Android developer Romain Guy says so here). So in order to properly use
EGL.getCurrentContext()
you would have to have a pre-existing EGL instance and call the getCurrentContext() method in the thread that created the EGLContext.
NOTE: Android now handles saving the EGLContext when the GLThread is paused/resumed in the GLSurfaceView class (take a look at the setPreserveEGLContextOnPause(boolean preserveOnPause) method).
There seems to be a bug in Android's implementation of EGL10.eglGetCurrentContext(), where the result of eglGetCurrentContxt() has to be compared using
result.equals(EGL10.EGL_NO_CONTEXT)
rather than
result == EGL10.EGL_NO_CONTEXT
For example:
if (((EGL10) EGLContext.getEGL()).eglGetCurrentContext().equals(EGL10.EGL_NO_CONTEXT)) {
// no current context.
}
You could try testing it to see if it is null, rather than equal to a given context. This is what I would do in a standard opengl program.
[EDIT] There's an example here which uses it as follows:
if ((eglGetCurrentContext () != context->egl_context) ||
(eglGetCurrentSurface ( EGL_READ ) != drawable->egl_surface))
I don't know if that's any help.