从Shoutcast获得打嗝噪音

时间:2012-01-23 02:54:16

标签: windows-phone-7 streaming shoutcast

我正在尝试阅读Shoutcast流,然后使用MediaStreamSource播放它。这是优秀的开源project,节省了我很多时间。经过一点点修改后,我能听到完美的声音。但问题是我得到了周期性的短促/打嗝声。

知道如何阻止这种噪音。我认为它可能是Shoutcast在间隔中发送一些元数据但是没有找到如何阻止它。试过request.Headers["Icy-MetaData"] = "0"; 但它也没有解决我的问题。任何帮助将不胜感激。

EDIT1: 我做了一些调查。我读了我的流数据2-3分钟,发现该流中有很多'零'字节。这是'0'字节索引列表

92 247 359 1208 1904 2037 2227 2397 2536 2694 2740 2863 2952 3048 3110 3689 3994 4027 4098 4218 4730 4830 4943 5029 5115 5248 5315 5358 5666 6084 6375 6873 6920 7441 7660 7700 7756 8174 8254 8614 9010 9018 9025 9039 9541 9846。 ....

是因为httpwebrequest缓慢下载/无法下载或Shoutcast本身发送这些零字节?这个'0'字节也会导致打嗝噪音吗?

EDIT2: 以下是我从shoutcast

获得响应的几行代码
        HttpWebRequest request = result.AsyncState as HttpWebRequest;
        HttpWebResponse response = request.EndGetResponse(result) as HttpWebResponse;     
        r = response.GetResponseStream();
        ShoutcastHeader(r);

这是我的ShoutcastHeader方法定义:

        StreamReader headerReader = new StreamReader(r);
        bool headerIsDone = false;
        while (!headerIsDone)
        {
            string headerLine = headerReader.ReadLine();

            if (headerLine.StartsWith("icy-name:"))
            {
                StationName = headerLine.Substring(9);
            }
            else if (headerLine.StartsWith("icy-genre:"))
            {
                Genre = headerLine.Substring(10);
            }
            else if (headerLine.StartsWith("icy-br:"))
            {
                BitRate = short.Parse(headerLine.Substring(7));
            }
            else if (headerLine.StartsWith("icy-metaint:"))
            {
                MetaInt = int.Parse(headerLine.Substring(12)) * 1111084;
                MetadataAvailable = true;
            }
            else if (headerLine.Equals(""))
                headerIsDone = true;
        }

这是headerReader

中的响应

ICY 200 OK icy-notice1:
此流需要Winamp
icy-notice2:SHOUTcast分布式网络音频服务器/ Linux v1.9.93atdn
冰名:宝莱坞&超越 - NRI 24/7电台 冰冷的流派:印度印地语泰米尔语泰卢固语马拉雅拉姆语Desi 冰冷-的URL:http://www.radionri.com 内容类型:音频/ MPEG 冰冷-PUB:1 冰冷-BR:128

此外,我将流字节放在我的skydrive共享location中。

1 个答案:

答案 0 :(得分:0)

Based on this thread看起来打嗝是定期重新发送的标题信息。还有issue on ShoutStreamSource project referencing this

  

“在解析第一个之后,当前的实现不会丢弃mp3header。这会导致来自流的声音中的hicups,并且将在不久的将来修复。”

然而,在这个答案的时候,看起来这个项目被搁置了。希望您或其他人可以添加此功能。至少知道问题是什么应该有助于解决方案。