2010-05-13 38 views
1

我正在通過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秒。任何幫助/見解讚賞。

J

+0

該緩衝區總是3.0秒沒有米你做什麼。即使您在QuickTime客戶端中啓用了Instant-On ... – Cipi 2010-06-09 13:35:28

回答

0

降低視頻質量。這會導致發送的數據更少,從而允許3s緩衝區更快地發送。

+0

延遲與視頻分辨率無關。 – JJFeiler 2011-03-25 17:34:52