如何消除 QuickTime 流式视频中的延迟
我正在制作一个客户端原型,该客户端通过 Quicktime 客户端显示来自 HaiVision Barracuda 的流视频。我一直无法将缓冲区大小减少到 3.0 秒以下...对于此应用程序,我们需要网络允许的尽可能低的延迟,并且更喜欢视频丢失而不是延迟。我正在执行以下操作:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSString *path = [[NSBundle mainBundle] pathForResource:@"haivision" ofType:@"sdp"];
NSError *error = nil;
QTMovie *qtmovie = [QTMovie movieWithFile:path error:&error];
if( error != nil ) {
NSLog(@"error: %@", [error localizedDescription]);
}
Movie movie = [qtmovie quickTimeMovie];
long trackCount = GetMovieTrackCount(movie);
Track theTrack = GetMovieTrack(movie,1);
Media theMedia = GetTrackMedia(theTrack);
MediaHandler theMediaHandler = GetMediaHandler(theMedia);
QTSMediaPresentationParams myPres;
ComponentResult c = QTSMediaGetIndStreamInfo(theMediaHandler, 1,kQTSMediaPresentationInfo,
&myPres);
Fixed shortdelay = 1<<15;
OSErr theErr = QTSPresSetInfo (myPres.presentationID,
kQTSAllStreams,
kQTSTargetBufferDurationInfo,
&shortdelay );
NSLog(@"OSErr %d", theErr);
[movieView setMovie:qtmovie];
[movieView play:self];
}
尽管 ComponentResult 和 OSErr 都返回 -50,但我似乎一直在获取有效的对象/结构直至 QTSPres。流媒体视频播放正常,但缓冲区仍为 3.0 秒。任何帮助/见解表示赞赏。
J
I'm prototyping a client that displays streaming video from a HaiVision Barracuda through a quicktime client. I've been unable to reduce the buffer size below 3.0 seconds... for this application, we need as low a latency as the network allows, and prefer video dropouts to delay. I'm doing the following:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSString *path = [[NSBundle mainBundle] pathForResource:@"haivision" ofType:@"sdp"];
NSError *error = nil;
QTMovie *qtmovie = [QTMovie movieWithFile:path error:&error];
if( error != nil ) {
NSLog(@"error: %@", [error localizedDescription]);
}
Movie movie = [qtmovie quickTimeMovie];
long trackCount = GetMovieTrackCount(movie);
Track theTrack = GetMovieTrack(movie,1);
Media theMedia = GetTrackMedia(theTrack);
MediaHandler theMediaHandler = GetMediaHandler(theMedia);
QTSMediaPresentationParams myPres;
ComponentResult c = QTSMediaGetIndStreamInfo(theMediaHandler, 1,kQTSMediaPresentationInfo,
&myPres);
Fixed shortdelay = 1<<15;
OSErr theErr = QTSPresSetInfo (myPres.presentationID,
kQTSAllStreams,
kQTSTargetBufferDurationInfo,
&shortdelay );
NSLog(@"OSErr %d", theErr);
[movieView setMovie:qtmovie];
[movieView play:self];
}
I seem to be getting valid objects/structures all the way down to the QTSPres, though the ComponentResult and OSErr are both returning -50. The streaming video plays fine, but the buffer is still 3.0seconds. Any help/insight appreciated.
J
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
降低视频质量。这将导致发送的数据更少,从而使 3 秒缓冲区的发送速度更快。
Lower the video quality. This will result in less data to send allowing the 3s buffer to be sent faster.