We have a native Android webrtc-based voip app. Only in our Android app (as opposed to other platforms), the local camera stream is rotated after being in a call for a while. Usually it takes about 10 seconds. But sometimes more, even as much as a minute.
The remote will get the stream rotated as well, so it's not a rendering issue.
The stream is always rotated 90 degrees clockwise in portrait orientation, but is correct in one landscape orientation and upside down in the other landscape orientation.
After a while, the stream will be rotated back to the correct orientation again (and back to bugged after a while again).
I've tried several revisions ranging from early 8xxx to the latest (9125), all have the same problem. Apprtc demo has the problem as well. I've tested on several different phones (although only Samsung devices) and the problem exists on all of them.
I was faced with the same issue and I didn't found a right solution, but there is a workaround. I found that the reason of the rotation is cpu overuse detection, it leads to changing quality and it seems there is some bug in this functionality in android implementation. So I just added peerConnectionConstraints.optional.add(new MediaConstraints.KeyValuePair("googCpuOveruseDetection", "false"));
and it prevented this rotation.
Related
I made a prototype of a video recording app using CWAC-Camera version 0.4.2 a while back and I was able to record in portrait mode.
I'm now moving forward with the project and upgraded to the latest version 0.6.3 and if the device is not in landscape it throws an UnsupportedOperationException: Video recording supported only in landscape.
I'd like to use the library but don't want to force the user to landscape for recording. Do I have to implement my own CameraView? I can't seem to find any comments on why landscape is required.
Any guidance would be great.
I can't seem to find any comments on why landscape is required.
Because, AFAIK, portrait recording never worked. It certainly never worked when I tried it -- the recordings all came out landscape.
There is an outstanding issue to restore portrait recording, doing something on devices where the video comes out wrong. I expect to address that in the 0.7.0 timeframe. In the meantime, drop back to 0.6.2, where IIRC portrait recording, with all its flaws, was still allowed.
In my AS3 Flex Mobile application for Android, I am using camera and it is being automatically rotated 90 degrees before I even done any video rotation by myself, it seems like it's a known bug in AIR. But I was wondering if anyone found a solution since it's really pretty important feature for mobile application developer.
I've tried to do some rotation manually in my code, but it is only fixes the view on my display, but still sends the wrong video to the receiver.
If any code is required I will add the snippets
Please let me know.
As you mentioned, this is a known bug with AIR. It is not consistent, either. On some devices, it is in the correct orientation but in some (and all iOS devices, I believe, though I haven't fully tested that), it is rotated as you are seeing. For example, it was always oriented correctly on my Nexus 4 and on my Nexus 5, but a friends Moto X is rotated incorrectly.
Unfortunately, I don't believe there is anything you can do short of having the user do a calibration (i.e. overlay a straight line and tell them to place it horizontally and click a button) and rotating the camera display and any images you take with the display.
That being said, if you are using the camera to take photos, I highly recommend using CameraUI instead, which is the native implementation.
I've faced the same issue today but i'm developping in Java, not with AIR so i don't know if it the same, for me the solution was to add this line before starting the recording.
mMediaRecorder.setOrientationHint(90);
When using setOrientationHint for recording videos, Samsung and Motorola phones simply write this value into the Rotation Metadata.
However, it appears HTC phones do not write this value into the metadata and actually attempt to rotate the video after recording. The phones I have tried on Android 4.0.3 and lower actually rotate it 90 degrees no matter the value and the 4.0.4 phones rotate it as per the value.
Has anyone else noticed this behavior and what is the best way to fix this?
In my experience, there's nothing you can do to unify all devices. Some devices add metadata, some rotate the byte array, and some dismiss it altogether.
Another problem you have with metadata is that just as the recording devices differ, so do the playback devices, in Windows for example you might have noticed that jpeg metadata (EXIF) is ignored and all images are displayed landscape.
I would have hoped by now that the hardware manufacturers would have had certain hoops to jump through with regards to camera hardware but it seems that this is still a problem.
I am busy writing an app that lets me use my phone (Galaxy S2 2.2.3) as a steering wheel. Just a nerdy weekend project really.
I have gotten everything working regarding calculating the orientation of the device using SensorManager.GetOrientation() with a slight snag. The rotation around the axis which comes out of the screen and back of the phone rises from 0 to 90 degrees and then falls back down in the same manner to 0 degrees instead of proceeding to 180.
This had me really confused until I read something somewhere that suggested the API might be flipping (internally as the screen doesn't flip) orientation so the phones coordinates system is flipping from left to right landscape (Its worth noting that I have it locked in landscape mode in the Manifest). This explains the weird behaviour in terms of orientation.
Does anyone know how to stop this happening, or have I gone wrong completely in my understanding?
I am trying out the (latest) Android SDK, and noticed some strange behavior.
I've written a skeletal SurfaceView app: Activity, SurfaceView and a rendering thread. It doesn't actually do any painting, and only writes out the framerate to logcat once a second. When it runs in portrait mode, I get around 60 fps. However, when I flip it to landscape the framerate drops to about 30 fps.
I have also tested it on the LunarLender sample, and got similiar results. All of the testing are done on the emulator, since I don't have a physical device.
What's it all about? I can't seem to find any mentioning to this on Google, have anyone else experienced that? Is it just an emulator quirk or does it apply to physical hardware too?
Guessing here- in landscape mode, is there extra "blank" space on either side of the rendered content? If so there could be an effective increase in the amount of processing just to paint the screen. Don't know if that should account for a 50% decrease in framerate, but it's possible.
Another guess- landscape mode may be deliberately throttled because it's intended primarily for video viewing. No reason to go up to 60fps for 30fps content. Configuration?