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
This commit is contained in:
parent
1172e5efc7
commit
2cf5d596ee
@ -311,7 +311,7 @@ granulepos_to_granule_default (GstOggStream * pad, gint64 granulepos)
|
|||||||
{
|
{
|
||||||
gint64 keyindex, keyoffset;
|
gint64 keyindex, keyoffset;
|
||||||
|
|
||||||
if (pad->granuleshift != 0) {
|
if (pad->granuleshift != 0 && pad->granuleshift != -1) {
|
||||||
keyindex = granulepos >> pad->granuleshift;
|
keyindex = granulepos >> pad->granuleshift;
|
||||||
keyoffset = granulepos - (keyindex << pad->granuleshift);
|
keyoffset = granulepos - (keyindex << pad->granuleshift);
|
||||||
return keyindex + keyoffset;
|
return keyindex + keyoffset;
|
||||||
@ -327,7 +327,7 @@ granule_to_granulepos_default (GstOggStream * pad, gint64 granule,
|
|||||||
{
|
{
|
||||||
gint64 keyoffset;
|
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
|
/* 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
|
at 0 or 1, depending on bitstream version. If nothing else, this
|
||||||
avoids getting negative granpos back. */
|
avoids getting negative granpos back. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user