avmedia/source/macavf/player.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
New commits: commit 75c804c1be8acf4c3fc9935b81e696918f33fd9d Author: Herbert Dürr <h...@apache.org> Date: Thu May 15 09:46:26 2014 +0000 AOO: #i124875# use AVAsset's best guess duration if AVPlayerItem isn't ready yet in AV Foundation the most accurate media asset duration is available when the AVPlayerItem's status changes to AVPlayerItemStatusReadyToPlay. There already is an observer for this, but the upper layers expect getDuration() to be synchronous and to return within a reasonable time. Since returning an approximation is sufficient using the AVAsset's duration as fallback is fine. diff --git a/avmedia/source/macavf/player.mm b/avmedia/source/macavf/player.mm index 404083b..751dbed 100644 --- a/avmedia/source/macavf/player.mm +++ b/avmedia/source/macavf/player.mm @@ -216,7 +216,10 @@ double SAL_CALL Player::getDuration() if( mpPlayer ) { AVPlayerItem* pItem = [mpPlayer currentItem]; - duration = CMTimeGetSeconds( [pItem duration] ); + if( [pItem status] == AVPlayerItemStatusReadyToPlay ) + duration = CMTimeGetSeconds( [pItem duration] ); + else // fall back to AVAsset's best guess + duration = CMTimeGetSeconds( [[pItem asset] duration] ); } return duration;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits