从 Shoutcast 中获得打嗝声 [英] Getting hiccup noise from Shoutcast

查看:26
本文介绍了从 Shoutcast 中获得打嗝声的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试读取 Shoutcast 流,然后使用 MediaStreamSource 播放它.这是出色的开源项目,它为我节省了大量时间.经过一点点修改后,我能够听到完美的声音.但问题是我收到了周期性的 blip/hiccup 噪音.

I'm trying to read Shoutcast stream and then play it using MediaStreamSource. Here is the excellent open source project that saved lot of my time. After little bit modification I'm able to hear perfect sound. But the problem is I'm getting a periodic blip/hiccup kind of noise.

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

Any idea how I can stop that noise. I thought its may be Shoutcast sends some metadata in interval but don't find out how to stop that. Tried with request.Headers["Icy-MetaData"] = "0"; But it doesn't fix my problem either. Any help will be greatly appreciated.

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

I did some more investigation. I read my stream data for 2-3 mins and found that there are lot of 'zero' byte in that stream. Here is the list of index of '0' byte

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.....

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"字节也会导致打嗝噪音吗?

Is it because httpwebrequest slow download/failed to download or Shoutcast itself sending those zero bytes? Also does this '0' bytes causing that hiccup noise?

编辑 2:这是我如何从shoutcast 获得响应的几行代码

Here is few line of code of how I'm getting response from shoutcast

        HttpWebRequest request = result.AsyncState as HttpWebRequest;
        HttpWebResponse response = request.EndGetResponse(result) as HttpWebResponse;     
        r = response.GetResponseStream();
        ShoutcastHeader(r);

这是我的 ShoutcastHeader 方法定义:

And here is my ShoutcastHeader method definition:

        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 中的响应

And here is the response in headerReader

ICY 200 OKicy-notice1:
此流需要 Winamp
icy-notice2:SHOUTcast 分布式网络音频服务器/Linux v1.9.93atdn
冰雪名称:宝莱坞超越 - 无线电 NRI 24/7冰冷的流派:印度印地语泰米尔泰卢固马拉雅拉姆语德西冰冷的网址:http://www.radionri.com内容类型:音频/mpeg冰酒吧:1冰-br:128

ICY 200 OK icy-notice1:
This stream requires Winamp
icy-notice2:SHOUTcast Distributed Network Audio Server/Linux v1.9.93atdn
icy-name:Bollywood & Beyond - Radio NRI 24/7 icy-genre:Indian Hindi Tamil Telugu Malayalam Desi icy-url:http://www.radionri.com content-type:audio/mpeg icy-pub:1 icy-br:128

此外,我已将流字节放入我的 Skydrive 共享 位置.

Also I have places the stream bytes in my skydrive share location.

推荐答案

基于这个线程,看起来打嗝是定期重新发送的标头信息.在 ShoutStreamSource 项目上也有一个 问题引用此:

Based on this thread it looks like the hiccups are the header information being resent periodically. There is an issue on ShoutStreamSource project referencing this too:

在解析第一个 mp3headers 后,当前实现不会丢弃 mp3header.这会导致来自流的声音出现打嗝,并将在不久的将来修复."

"The current implementation does not discard the mp3headers after the first one has been parsed. This causes hicups in the sound coming from the stream, and will be fixed in the near future."

然而,在此回答时,该项目似乎已被搁置.希望您或其他人可以添加此功能.至少知道问题是什么应该有助于解决问题.

However at the time of this answer it looks like the project was put on hold. Hopefully you or someone else can add this functionality. At least knowing what the problem is should help with a solution.

这篇关于从 Shoutcast 中获得打嗝声的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆