我有一个球员在iOS上基于VLC通过mobileVLCKit.framework。
在执行和播放h264 rtsp流时,iPhone将正确显示视频。然而,在开始的几秒钟,有绿色屏幕显示。我认为原因是我的框架还没有到达,yuv=000被映射成绿色的rgb。
我可以添加一些选项或操作,迫使玩家在收到I-帧后发挥?还是有其他方法来避免绿屏问题?
这是我的密码
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super init];
if (self) {
self.player = [[VLCMediaPlayer alloc] init];
self.player.delegate = self;
self.player.media = [VLCMedia mediaWithURL:[NSURL URLWithString:@"rtsp://...."]];
self.player.drawable = self.contentView;
}
return self;
}
- (void)play
{
if (self.player && !self.player.isPlaying) {
[slef.player play];
}
}如有任何答复,将不胜感激。谢谢!
发布于 2016-02-24 09:09:46
实际上,修改应该在函数static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) of /modules/codec/avcodec/video.c中进行。
在DecodeVideo()函数的开头添加以下代码以跳过非i帧,这样就可以解决绿色屏幕问题。
if (p_sys->b_first_frame && b_gotpicture) {
if (AV_PICTURE_TYPE_I != frame->pict_type) {
av_frame_unref(frame);
break;
}
}然后,自己构建mobileVLCKit.framework。
https://stackoverflow.com/questions/29909737
复制相似问题