[libbluray-devel] _clip_seek_time(): log errors

hpi1 git at videolan.org
Thu Apr 14 14:19:49 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Apr 14 10:48:50 2016 +0300| [2dd7fd11965e08fdbadcb8f0f3e97e83168b8bbd] | committer: hpi1

_clip_seek_time(): log errors

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=2dd7fd11965e08fdbadcb8f0f3e97e83168b8bbd
---

 src/libbluray/bluray.c |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 9d43450..c2ea810 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1808,14 +1808,22 @@ static int64_t _clip_seek_time(BLURAY *bd, uint32_t tick)
 {
     uint32_t clip_pkt, out_pkt;
 
-    if (tick < bd->st0.clip->out_time) {
-
-        // Find the closest access unit to the requested position
-        nav_clip_time_search(bd->st0.clip, tick, &clip_pkt, &out_pkt);
+    if (!bd->title || !bd->st0.clip) {
+        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "_clip_seek_time(): no playlist playing\n");
+        return -1;
+    }
 
-        _seek_internal(bd, bd->st0.clip, out_pkt, clip_pkt);
+    if (tick >= bd->st0.clip->out_time) {
+        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "_clip_seek_time(): timestamp after clip end (%u < %u)\n",
+                 bd->st0.clip->out_time, tick);
+        return -1;
     }
 
+    // Find the closest access unit to the requested position
+    nav_clip_time_search(bd->st0.clip, tick, &clip_pkt, &out_pkt);
+
+    _seek_internal(bd, bd->st0.clip, out_pkt, clip_pkt);
+
     return bd->s_pos;
 }
 



More information about the libbluray-devel mailing list