I have my own RTSP Source Filter solution which is still under development but working with H.264/MPEG-4 video streams at the moment. My problem is at initialization stage. If I open graphedit and add RTSP source, decoder and video renderer filters one by one and connect their pins, everything works fine (RTSP Source URL is hardcoded at the moment). But if I try to save the graph and re-open the graph from saved file, the graph crashes. I think the reason is at my RTSP Source Filter's initialization part. Since my filter doesn't know anything about the streams at the beginning, it passes invalid parameters to the decoder. So, my questions are:

* How should I exactly handle the initialization process?
* When (which function in the code) should I exactly connect to the source and start transmission? Filter class constructor? Output pin class constructor? `OnThreadCreate`?
* Do we need to get some information like video width/height from streams or do we just need to pass the streams to decoder? What is the proper way of doing this? (I think some video renderers use width/height information from `VIDEOINFOHEADER` structure.)
* How should we decide our buffer size? In `GetMediaType` method, I set the sample size from bitmap info header like:

pMediaType->SetSampleSize(pvi->bmiHeader.biSizeImage);

How should I set the parameters like `biWidth`, `biHeight`, `biSize`, `biSizeImage` etc.? I believe I need to set them with some default values at the beginning and then change them after receiving the streams but how?

All questions indicates to the same problem. What should I exactly do at the initialization process of my RTSP Source Filter?

!UPDATE!

I just noticed that when I load a saved graph, disconnecting and re-connecting the pins between decoder and video renderer solves the problem. I tried it with different video renderers (microsoft's and some other custom video renderers). They all react similar. Some of them doesn't crash but runs video with incorrect size/aspect ratio. Apparently, what makes graph crash or causes weird results is not my source filter but some invalid information passed to the video renderer. Since this situation doesn't happen with other RTSP Source Filters, I still believe I'm doing something wrong, there is something missing.

What may cause this problem? Do I need to send some media information when graph starts running?

P.S: Graph crashes only when I run the graph. Just loading graph doesn't cause a crash.