【问题标题】:Video playback using MediaStreamSource, MediaElement on WP7在 WP7 上使用 MediaStreamSource、MediaElement 播放视频
【发布时间】:2014-11-19 00:00:01
【问题描述】:

我们一直在为原始 H.264 和 AAC 内容开发流式传输应用程序。我们正在使用 MediaStreamSource 向 MediaElement 提供样本,并且当我们使用 PC SilverLight(在 IE9 上)进行音频/视频播放时没有观察到任何问题。仅音频流在 WP7 上也可以正常工作。但是,我们在 WP7 上播放视频时面临以下问题:

•在没有 CodecPrivateData 的情况下初始化 MediaStreamSource 的视频流属性时,将调用 MediaElement "Failed" 事件处理程序,错误代码为 3100。视频流属性初始化为:

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

•当使用 CodecPrivateData ([start code] [sps] [startcode] [pps]) 初始化 MediaStreamSource 的视频流属性时,视频播放但似乎以更快的速度播放 - 是指定 FPS 的 2 到 3 倍. Video Stream 属性初始化为:

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

请注意,无论有无 CodecPrivateData,相同的流在 PC SilverLight 上都可以正常播放,包括音频和视频。 初始化视频流属性有问题吗?什么可能导致此问题,我们该如何解决?

问候, NKS。

【问题讨论】:

    标签: windows-phone-7


    【解决方案1】:

    这里的问题是用于时间戳的时钟。我们的应用程序用于按照 90Khz 计算时间戳,预期的时间戳以 1 Mhz 为单位。所以所有帧都在时间过去后出现,因此玩家会尽可能快地播放帧(我也看到了大约 120 fps 的东西)。修复时间戳时钟后,它工作正常

    【讨论】:

    • 我也有这个问题,你能帮帮我吗?
    • 对不起,上面的答案不是描述性的。我刚刚转换了每个样本的时间戳值。 newTs = oldTS * 90kHz/1MHz。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多