开发者

Video playback using MediaStreamSource, MediaElement on WP7

开发者 https://www.devze.com 2023-04-11 19:28 出处:网络
We have been working on a streaming application for raw H.264 and AAC content. We are using MediaStreamSource to feed samples to MediaElement and observe no issues when we use PC SilverLight (on IE9)

We have been working on a streaming application for raw H.264 and AAC content. We are using MediaStreamSource to feed samples to MediaElement and observe no issues when we use PC SilverLight (on IE9) for audio/video playback. Audio-only stream also works fine on WP7. However, we face following problems with video playback on WP7:

•When video stream attribute for MediaStrea开发者_C百科mSource is initialized without CodecPrivateData, MediaElement "Failed" event handler is called with error code 3100. Video Stream attribute is initialized as:

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

•When video stream attribute for MediaStreamSource is initialized with CodecPrivateData ([start code] [sps] [startcode] [pps]) the video plays but seems to be playing at a much faster rate - 2 to 3 times the specified FPS. Video Stream attribute is initialized as:

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

Note that the same streams play fine on PC SilverLight with and without CodecPrivateData with audio as well as video. Is there something wrong in which video stream attribute is initialized? What could be causing this problem and how can we resolve it?

Regards, NKS.


The problem here was the clock that was being used for the timestamp. Our application used to calculate the timestamp as per 90Khz, the expected timestamp was in terms of 1 Mhz. So all the frames appeared after the time was elapsed and hence the player would play the frames as fast as it could (I had seen something around 120 fps also). after fixing the timestamp clock, it works fine

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号