Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
AnswerRe: Analogclock and timer Pin
nike_arh12-May-09 10:38
nike_arh12-May-09 10:38 
GeneralRe: Analogclock and timer Pin
Aljaz11112-May-09 12:07
Aljaz11112-May-09 12:07 
AnswerRe: Analogclock and timer Pin
Aljaz11112-May-09 12:44
Aljaz11112-May-09 12:44 
QuestionImages in Gridview Pin
stewy0912-May-09 6:11
stewy0912-May-09 6:11 
AnswerRe: Images in Gridview Pin
Henry Minute12-May-09 7:18
Henry Minute12-May-09 7:18 
Questionrunning out of memory, issues with GC Pin
Jon Hulatt12-May-09 5:46
Jon Hulatt12-May-09 5:46 
AnswerRe: running out of memory, issues with GC Pin
Luc Pattyn12-May-09 6:51
sitebuilderLuc Pattyn12-May-09 6:51 
GeneralRe: running out of memory, issues with GC Pin
Jon Hulatt12-May-09 8:06
Jon Hulatt12-May-09 8:06 
Luc Pattyn wrote:
1. how are you setting the callback?


My main form in the c# app implements an interface, ICaptureCallback, which looks like this:-
interface ICaptureCallback
{
   // other stuff removed
   void ReturnFrame(byte[] frameData);
}


The C++/CLI class that calls this takes an ICaptureCallback parameter in it's contstructor.

Luc Pattyn wrote:
2. what is (or would be) the prototype of the callback in native C++?


Not sure why this is relevant; the callback is implemented solely in managed code.

Luc Pattyn wrote:
3. who is allocating and freeing the (native?) buffer that the callback is assumed to consume?


The data originates in a native buffer from ffmpeg, but these lines of code:-

array<Byte>^ jpegData = gcnew array<Byte>(Width * Height * 3);
  Marshal::Copy(IntPtr(pRgbFrame->data[0]),jpegData,0,Width * Height * 3);
  m_callback->ReturnFrame(jpegData);
  jpegData = nullptr;


which are from the C++/CLI class that does the call show that the data is Marshal.Copy'd into a managed byte array. Although I've not shown the code, I'm confident that the native buffer is properly freed.

Luc Pattyn wrote:
4. don't you close the file (m_outputWriter and m_outputFile)? without it, the stream grows bigger and bigger.


Because the objective of this app is to store the frames in a big binary file. Other code, which I've removed from the callback stored the offsets and frame sizes for later use. To close the file would stop the exact designed functionality of the app. Note, that the file is a disk file, not a memory stream, so should only get big on the disk, not take up much ram.

thanks for your interest.
Jon

using System.Beer;

GeneralRe: running out of memory, issues with GC Pin
Luc Pattyn12-May-09 9:19
sitebuilderLuc Pattyn12-May-09 9:19 
QuestionWorking with multiple forms Pin
bwood202012-May-09 5:34
bwood202012-May-09 5:34 
AnswerRe: Working with multiple forms Pin
OriginalGriff12-May-09 5:37
mveOriginalGriff12-May-09 5:37 
GeneralRe: Working with multiple forms Pin
bwood202012-May-09 5:56
bwood202012-May-09 5:56 
AnswerRe: Working with multiple forms Pin
DaveyM6912-May-09 5:49
professionalDaveyM6912-May-09 5:49 
GeneralRe: Working with multiple forms Pin
bwood202012-May-09 6:03
bwood202012-May-09 6:03 
GeneralRe: Working with multiple forms Pin
DaveyM6912-May-09 6:20
professionalDaveyM6912-May-09 6:20 
GeneralRe: Working with multiple forms Pin
bwood202012-May-09 7:17
bwood202012-May-09 7:17 
GeneralRe: Working with multiple forms Pin
Henry Minute12-May-09 7:28
Henry Minute12-May-09 7:28 
GeneralRe: Working with multiple forms Pin
bwood202012-May-09 9:13
bwood202012-May-09 9:13 
GeneralRe: Working with multiple forms Pin
Henry Minute12-May-09 9:22
Henry Minute12-May-09 9:22 
GeneralRe: Working with multiple forms Pin
bwood202012-May-09 9:48
bwood202012-May-09 9:48 
GeneralRe: Working with multiple forms Pin
Henry Minute12-May-09 10:00
Henry Minute12-May-09 10:00 
GeneralRe: Working with multiple forms Pin
bwood202012-May-09 11:10
bwood202012-May-09 11:10 
GeneralRe: Working with multiple forms Pin
Henry Minute12-May-09 11:54
Henry Minute12-May-09 11:54 
GeneralRe: Working with multiple forms Pin
bwood202013-May-09 4:02
bwood202013-May-09 4:02 
GeneralRe: Working with multiple forms Pin
bwood202013-May-09 6:20
bwood202013-May-09 6:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.