Hello,
I am using JPEGVideoSource to add a snapshot to customize the SearchResultUserControl class in a plugin integration, but I am facing an increasing SmartClient memory use after each time the search runs. The call to JPEGVideoSource.Close() doesn’t seem to fix the issue.
Please let me know if I am doing something wrong.
Below the code :
public partial class MyResultControl : SearchResultUserControl
{
public MyResultControl()
{
InitializeComponent();
DataContext = this;
}
public ImageSource Image { get; set; }
public string EventName { get; set; }
public string DHM { get; set; }
public override void Init(SearchResultData searchResultData)
{
var result = (MySearchResultData)searchResultData;
EventName = result.EventName;
DHM = result.TriggerTime.ToLocalTime().ToString();
Image = CameraScreenShot(result.Item, result.TriggerTime);
OnPropertyChanged(nameof(EventName));
OnPropertyChanged(nameof(DHM));
OnPropertyChanged(nameof(Image));
}
private BitmapSource CameraScreenShot(VideoOS.Platform.Item cam, DateTime dhm)
{
BitmapSource bmps = null;
if (cam.FQID.Kind == VideoOS.Platform.Kind.Camera)
{
JPEGVideoSource \_imageVideoSource = new JPEGVideoSource(cam);
\_imageVideoSource.Init();
var imgData = \_imageVideoSource.GetAtOrBefore(dhm.ToUniversalTime()) as JPEGData;
if (imgData != null)
{
bmps = imgData.ConvertToBitmapSource();
}
\_imageVideoSource.Close();
}
return bmps;
}
}