RenderToJpegAsync() giving System.Runtime.InteropServices.SEHException

145 views Asked by At

I am trying to use Nokia Imaging SDK to filter a live camera stream and saving the stream data to an Image file. I am using Camera Stream example from Nokia Imaging.

Filter is working properly, but when I try to use EditingSession to save image, it gives me System.Runtime.InteropServices.SEHException . The code I am using to save image is -

MediaLibrary library = new MediaLibrary(); 
IBuffer jpegOut = await effects.Session.RenderToJpegAsync();
library.SavePicture(FileNamePrefix + DateTime.Now.ToString() + ".jpg", jpegOut.AsStream());

While effects.Session is actually the EditingSession used to apply filter on camera stream. I've used the same method to capture static image data, now I can't use it for streaming data. Any other way to save the filtered image??

1

There are 1 answers

0
0xC0DED00D On BEST ANSWER

I've solved it by capturing MediaElement into a WritableBitmap. Saving the image requires ID_CAP_MEDIALIB capability as pointed out here