Skip to content

Commit

Permalink
fix code format
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshalX committed Mar 3, 2022
1 parent 752b0fd commit 492175a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
9 changes: 2 additions & 7 deletions python-webrtc/python/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,10 @@ async def main():
# transceivers = pc.get_transceivers()

params = webrtc.RtpEncodingParameters(
max_bitrate=1234,
max_framerate=20,
rid="lolkek",
scale_resolution_down_by=2.0
max_bitrate=1234, max_framerate=20, rid="lolkek", scale_resolution_down_by=2.0
)
init = webrtc.RtpTransceiverInit(
direction=webrtc.TransceiverDirection.recvonly,
send_encodings=[params],
streams=[stream]
direction=webrtc.TransceiverDirection.recvonly, send_encodings=[params], streams=[stream]
)

transceiver = pc.add_transceiver(webrtc.MediaType.audio)
Expand Down
10 changes: 5 additions & 5 deletions python-webrtc/python/webrtc/interfaces/rtc_peer_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def add_track(
return RTCRtpSender._wrap(sender)

def add_transceiver(
self,
track_or_kind: Union['webrtc.MediaStreamTrack', 'webrtc.MediaType'],
init: Optional['webrtc.RtpTransceiverInit'] = None,
self,
track_or_kind: Union['webrtc.MediaStreamTrack', 'webrtc.MediaType'],
init: Optional['webrtc.RtpTransceiverInit'] = None,
) -> 'webrtc.RTCRtpTransceiver':
"""Creates a new :obj:`webrtc.RTCRtpTransceiver` and adds it to the set of transceivers associated with the
connection. Each transceiver represents a bidirectional stream, with both an :obj:`webrtc.RTCRtpSender` and
Expand All @@ -124,15 +124,15 @@ def add_transceiver(
Returns:
:obj:`webrtc.RTCRtpSender`: The :obj:`webrtc.RTCRtpSender` object which will be used to
transmit the media data.
"""
"""
from webrtc import MediaType, RTCRtpTransceiver

if init:
init = init._native_obj

if isinstance(track_or_kind, MediaType):
transceiver = self._native_obj.addTransceiver(track_or_kind, init)
else: # its wrapped track
else: # its wrapped track
transceiver = self._native_obj.addTransceiver(track_or_kind._native_obj, init)

return RTCRtpTransceiver._wrap(transceiver)
Expand Down
12 changes: 6 additions & 6 deletions python-webrtc/python/webrtc/models/rtp_encoding_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ class RtpEncodingParameters(WebRTCObject):
_class = wrtc.RtpEncodingParameters

def __init__(
self,
active: Optional[bool] = True,
max_bitrate: Optional[int] = None,
max_framerate: Optional[float] = None,
rid: Optional[str] = None,
scale_resolution_down_by: Optional[float] = None
self,
active: Optional[bool] = True,
max_bitrate: Optional[int] = None,
max_framerate: Optional[float] = None,
rid: Optional[str] = None,
scale_resolution_down_by: Optional[float] = None,
):
# TODO so hacky ;d need to be able to wrap already created native objects
if isinstance(active, self._class):
Expand Down
8 changes: 4 additions & 4 deletions python-webrtc/python/webrtc/models/rtp_transceiver_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class RtpTransceiverInit(WebRTCObject):
_class = wrtc.RtpTransceiverInit

def __init__(
self,
direction: Optional['webrtc.RtpTransceiverDirection'] = None,
send_encodings: Optional[List['webrtc.RtpEncodingParameters']] = None,
streams: Optional[List['webrtc.MediaStream']] = None,
self,
direction: Optional['webrtc.RtpTransceiverDirection'] = None,
send_encodings: Optional[List['webrtc.RtpEncodingParameters']] = None,
streams: Optional[List['webrtc.MediaStream']] = None,
):
super().__init__()

Expand Down

0 comments on commit 492175a

Please sign in to comment.