问题
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:
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";
来源:https://stackoverflow.com/questions/8201886/h-264-video-play-using-mediastreamsource-meet-with-3100-mediaerror-on-wp7-emul