H.264 video play (using MediaStreamSource) meet with 3100 MediaError on WP7 emulator

1.5k Views Asked by At

We're trying to play a H.264 stream with MediaStreamSource on WP7 emulator. But met with 3100 error with video:

In override method OpenMediaAsync of Mp4MediaStreamSource, videoStreamAttribute VideoFourCC is set as “H264”:

Dictionary<MediaStreamAttributeKeys, string> videoStreamAttributes = new Dictionary<MediaStreamAttributeKeys, string>();
videoStreamAttributes[MediaStreamAttributeKeys.VideoFourCC] = "H264";
this.videoStreamDescription = new MediaStreamDescription(MediaStreamType.Video, videoStreamAttributes);

But GetSampleAsync was not called at all after OpenMediaAsync, MediaElement just return error “3100 An error has occurred”, no more other information. And same error even if we set CodecPrivateData attribute.

1

There are 1 best solutions below

0
On

According to this article you must set [MediaStreamAttributeKeys.CodecPrivateData]

in the format that codec is expecting ([START_CODE][SPS][START_CODE][PPS])

videoStreamAttributes[MediaStreamAttributeKeys.CodecPrivateData] = "000000012742000D96540A0FD8080F162EA00000000128CE060C88";