nicolas2k / google-glass-api

Automatically exported from code.google.com/p/google-glass-api
1 stars 0 forks source link

using LiveCard as camera preview gives error #373

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a LiveCard, with 
liveCard.setDirectRenderingEnabled(true);
liveCard.getSurfaceHolder().addCallback(callback);

2. set up camera recording as per the MediaRecorder tutorial
Camera camera = Camera.open();
// Google Glass workaround, see 
https://code.google.com/p/google-glass-api/issues/detail?id=360#c6
try {
    camera.setPreviewDisplay(null);
} catch (java.io.IOException ioe) {
    Log.d("OR", "IOException nullifying preview display: " + ioe.getMessage());
}
camera.stopPreview();
camera.unlock();
recorder = new MediaRecorder();
recorder.setCamera(camera);
recorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
recorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
File f = new File(getBaseDir(), getStartTime() + VIDEO_EXTENSION);
recorder.setOutputFile(f.getAbsolutePath());

3. specify the live card as the preview surface:
recorder.setPreviewDisplay(liveCard.getSurfaceHolder().getSurface());

What is the expected output? What do you see instead?
the expected output is that the LiveCard would act as a camera preview surface.

instead, I get the following:

01-22 18:00:14.746: E/SurfaceTextureClient(4656): queueBuffer: error queuing 
buffer to SurfaceTexture, -22
01-22 18:00:14.746: E/SurfaceTextureClient(4656): queueBuffer (handle=0x975198) 
failed (Invalid argument)
01-22 18:00:14.839: E/MediaRecorder(4656): start failed: -12
01-22 18:00:14.855: E/OR(4656): MediaRecorder error class 
java.lang.RuntimeException
01-22 18:00:14.855: E/OR(4656): java.lang.RuntimeException: start failed.
01-22 18:00:14.855: E/OR(4656):     at android.media.MediaRecorder.start(Native 
Method)

What version of the product are you using? On what operating system?
XE12

Please provide any additional information below.

Original issue reported on code.google.com by maroy.akos@gmail.com on 22 Jan 2014 at 12:36

GoogleCodeExporter commented 8 years ago
Hello,

Thanks for the report! Could you tell us when you actually start the recording? 
Are you doing this when you create/publish the LiveCard or on a 
DirectRenderingCallback's onSurfaceCreated callback?

For the former case, the SurfaceHolder might not have been created yet which 
would explain the failure.

Best,
Alain

Original comment by ala...@google.com on 27 Jan 2014 at 5:38

GoogleCodeExporter commented 8 years ago
Closing this bug as "Obsolete", please re-open with more information if this 
issue is still relevant.

Original comment by ala...@google.com on 28 Apr 2014 at 11:01