如何消除快速流式视频中的延迟

时间:2010-05-13 20:46:16

标签: macos video-streaming buffer quicktime low-latency

我正在通过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];
}

我似乎一直在获得有效的对象/结构到QTSPres,尽管ComponentResult和OSErr都返回-50。流视频播放正常,但缓冲仍然是3.0秒。任何帮助/见解表示赞赏。

Ĵ

1 个答案:

答案 0 :(得分:0)

降低视频质量。这将导致发送的数据更少,从而可以更快地发送3s缓冲区。