Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.

Public Report
Report From: Delphi-BCB/FireMonkey/Components    [ Add a report in this area ]  
Report #:  108967   Status: Closed
FireMonkey Demo - VideoCaptureHD - Video capture rendering stutter or freezes!
Project:  Delphi Build #:  17.0.4625.53395
Version:    17.0 Submitted By:   valtteri hakkarainen
Report Type:  Crash / Data loss / Total failure Date Reported:  9/24/2012 4:35:59 AM
Severity:    Critical / Show Stopper Last Updated: 4/23/2013 8:08:20 AM
Platform:    All platforms Internal Tracking #:   32233
Resolution: Fixed (Resolution Comments) Resolved in Build: : XE4
Duplicate of:  None
Voting and Rating
Overall Rating: (1 Total Rating)
5.00 out of 5
Total Votes: 22
Description
I'm requesting for solution on the following problem:
We have now run the video capture sample application "\RAD Studio\10.0\Samples\FireMonkey\VideoCaptureHD" on the following Windows platforms:
XP SP3 32bit
Vista SP2 32bit
Windows 7 SP1 64bit

On all these platforms, the video capture/draw works badly and/or with severe (stuttering) errors, and even fails completely all of a sudden.
I've debugged and tested the program, and I found out that the OnSampleBufferReady event of the TVideoCaptureDevice class executes in correctly in real time, but when the image is drawn according to the test program:

"VideoCamera.SampleBufferToBitmap(Image1.Bitmap, True);"

the problems start.

On the Mac OS X, 10.7.4 platform however, the test program mentioned above works correctly, and there is no stuttering errors. Therefore, I believe that the problem lies in the drawing and processing of the image, especially as regards Windows platform(s).
Steps to Reproduce:
Execute sample program at ".\RAD Studio\10.0\Samples\FireMonkey\VideoCaptureHD"
Workarounds
None
Attachment
None
Comments

Tomohiro Takahashi at 9/24/2012 6:55:00 AM -
> I found out that the OnSampleBufferReady event of the TvideoCaptureDevice class executes in correctly in real time,
I guess the event handler is called under Non-MainThread context. So, we might need to consider multi-thread issue...

Anyway, I will check the demo project...

Tomohiro Takahashi at 9/25/2012 9:42:53 PM -
This is simpler. This works on both Windows and Mac OS X.
---------------
procedure TForm240.SampleBufferReady(Sender: TObject; const ATime: TMediaTime);
var
  bmp: TBitmap;
begin
  bmp := TBitmap.Create(0, 0);
  VideoCamera.SampleBufferToBitmap(bmp, True);
  TThread.Synchronize(nil,
    procedure
    begin
      Image1.Bitmap.Assign(bmp);
    end
  );
  bmp.Free;
end;
---------------

valtteri hakkarainen at 9/26/2012 2:44:34 AM -
var
  bmp: TBitmap;
begin
  bmp := TBitmap.Create(0, 0);
  VideoCamera.SampleBufferToBitmap(bmp, True);
  TThread.Synchronize(nil,
    procedure
    begin
      Image1.Bitmap.Assign(bmp);
    end
  );
  bmp.Free;

----------------
This model does not work either. An additional disadvantage: there will be unnecessary memory copying, and at its worst, a deadlock. The latter can be avoided by taking necessary measures, but it won't fix the issue.
----------------

Tomohiro Takahashi at 9/26/2012 7:15:09 AM -
> This model does not work either.
What does 'does not work'? Do you get any AccessVolation or broken image etc...?

Server Response from: ETNACODE01