summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2017-11-04 11:29:52 +0100
committerEdward Hervey <bilboed@bilboed.com>2017-12-01 10:02:03 +0100
commitcaef38a849c081eb52944d676b0d83a1692a8870 (patch)
tree286219dd2dc6e500815453b4e50020809719a442
parent5e7d31c341ba296fa8485569f272638735f5b0b9 (diff)
downloadgstreamer-plugins-base-caef38a849c081eb52944d676b0d83a1692a8870.tar.gz
oggstream: Fix default granuleshift usage
For stream mappers that don't set a specific granuleshift, it will have the default value of -1. Protect the code for that and return the granule value as-is
-rw-r--r--ext/ogg/gstoggstream.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/ogg/gstoggstream.c b/ext/ogg/gstoggstream.c
index c24fa2bc9..5577ef39c 100644
--- a/ext/ogg/gstoggstream.c
+++ b/ext/ogg/gstoggstream.c
@@ -311,7 +311,7 @@ granulepos_to_granule_default (GstOggStream * pad, gint64 granulepos)
{
gint64 keyindex, keyoffset;
- if (pad->granuleshift != 0) {
+ if (pad->granuleshift != 0 && pad->granuleshift != -1) {
keyindex = granulepos >> pad->granuleshift;
keyoffset = granulepos - (keyindex << pad->granuleshift);
return keyindex + keyoffset;
@@ -327,7 +327,7 @@ granule_to_granulepos_default (GstOggStream * pad, gint64 granule,
{
gint64 keyoffset;
- if (pad->granuleshift != 0) {
+ if (pad->granuleshift != 0 && pad->granuleshift != -1) {
/* If we don't know where the previous keyframe is yet, assume it is
at 0 or 1, depending on bitstream version. If nothing else, this
avoids getting negative granpos back. */