Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

sendrecv.py: poll bus with asyncio #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MathieuDuponchelle
Copy link
Contributor

No description provided.

@@ -113,7 +133,11 @@ def start_pipeline(self):
self.webrtc.connect('pad-added', self.on_incoming_stream)
self.pipe.set_state(Gst.State.PLAYING)

async def handle_sdp(self, message):
self.bus = self.pipe.get_bus()
pollfd = self.bus.get_pollfd()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second user of the new API I added in 1.14 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I was pretty happy to see this had just been added, however I had to fix an annotation issue right after 1.14.2 was merged, which reminds me this will break unless master is used :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could put this in a try except block for now?

def poll_cb(self):
done = False
while self.bus.peek() != None:
msg = self.bus.pop()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can directly pop or not? Without peek first

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that I could, as poll_cb will get called again immediately if all messages haven't been read, not sure what's best?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants