gst1: Fix buffer.pts not being set if 0
This commit is contained in:
parent
45dae06347
commit
ef5281488b
@ -29,9 +29,9 @@ def create_buffer(data, capabilites=None, timestamp=None, duration=None):
|
||||
``capabilites`` argument is no longer in use
|
||||
"""
|
||||
buffer_ = Gst.Buffer.new_wrapped(data)
|
||||
if timestamp:
|
||||
if timestamp is not None:
|
||||
buffer_.pts = timestamp
|
||||
if duration:
|
||||
if duration is not None:
|
||||
buffer_.duration = duration
|
||||
return buffer_
|
||||
|
||||
|
||||
@ -3,10 +3,27 @@ from __future__ import absolute_import, unicode_literals
|
||||
import datetime
|
||||
import unittest
|
||||
|
||||
import gi
|
||||
gi.require_version('Gst', '1.0')
|
||||
from gi.repository import Gst
|
||||
|
||||
import pytest
|
||||
|
||||
from mopidy.audio import utils
|
||||
from mopidy.models import Album, Artist, Track
|
||||
|
||||
|
||||
class TestCreateBuffer(object):
|
||||
|
||||
def test_creates_buffer(self):
|
||||
buf = utils.create_buffer(b'123', timestamp=0, duration=1000000)
|
||||
|
||||
assert isinstance(buf, Gst.Buffer)
|
||||
assert buf.pts == 0
|
||||
assert buf.duration == 1000000
|
||||
assert buf.get_size() == len(b'123')
|
||||
|
||||
|
||||
# TODO: keep ids without name?
|
||||
# TODO: current test is trying to test everything at once with a complete tags
|
||||
# set, instead we might want to try with a minimal one making testing easier.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user