This project has moved. For the latest updates, please go here.

MediaStreamSource SampleRequested

Nov 19, 2014 at 11:39 AM
Hi Henric,
           I have a question in regard to MediastreamSource GetSamples for WinRT , and below are the details.
I have 30s duration Mp4 files fetching from the server, then AVC h.264 stream, and i parse for SPS, PPS NAL units from Mp4 , then i construct one complete stream by appending start codes for each NAL unit (3 byte 001) and with SPS and PPS at the start of the stream, the stream plays nicely, each sample i feed on SampleRequested is one MP4 file (30 s duration). so there is no problem in Playback when i have the mp4 file chunks locally.

But I have problems when downloading the file simultaneously and feeding it to SampleRequested.

if i have a sample to 10 mp4 chunks playing a certain video, when i receive one mp4 chunk i immediately feed it to the samplerequest from MediaStreamSource, if the samples are downloading i first request for deferral and Asynchronous block until i receive a sample .

Even though i and sending the sample when i receive to the sample request callback, it does not play until there are no more samples to load , that is i send NULL for sample request.

Problem is it does not play immediately as soon as i feed the first sample.But plays all 10 samples once ,and when i say no more samples. Null to sample request.

not sure whats happening here.

Appreciate your HELP, Please let me know what i am doing wrong here.

CIrano
Coordinator
Nov 19, 2014 at 8:30 PM
I'm not sure if any of the following cam cause the symptoms you describe, but it is where I would start looking.

Check the timestamps you pass to the MediaStreamSourceSampleRequest. Are they increasing monotonically and do they start approximately where you told the MediaStreamSourceStartingEventArgs's Request.SetActualStartPosition()?

Have you set the MediaStreamSource.BufferTime to something very high? If you have set it to something, try not setting it.

Have you set a bitrate for the video descriptor, if so, does it match the actual stream's bitrate? If you have set it, try not setting it. Ditto for the frame rate.

Good luck.
Nov 20, 2014 at 6:30 AM
Dear Henric,
               my code sample is at the following location (http://1drv.ms/1uAjJ8q) , its a very simple code for prototyping, please check and let me know what mistakes  i am doing here , its just waiting for all chunks and then playing. 
REALLY appreciate your help Sir .

Cirano