repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PetrochukM/PyTorch-NLP | torchnlp/datasets/zero.py | zero_dataset | def zero_dataset(train=False, dev=False, test=False, train_rows=256, dev_rows=64, test_rows=64):
"""
Load the Zero dataset.
The Zero dataset is a simple task of predicting zero from zero. This dataset is useful for
integration testing. The extreme simplicity of the dataset allows for models to learn th... | python | def zero_dataset(train=False, dev=False, test=False, train_rows=256, dev_rows=64, test_rows=64):
"""
Load the Zero dataset.
The Zero dataset is a simple task of predicting zero from zero. This dataset is useful for
integration testing. The extreme simplicity of the dataset allows for models to learn th... | [
"def",
"zero_dataset",
"(",
"train",
"=",
"False",
",",
"dev",
"=",
"False",
",",
"test",
"=",
"False",
",",
"train_rows",
"=",
"256",
",",
"dev_rows",
"=",
"64",
",",
"test_rows",
"=",
"64",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"is_requested",
"... | Load the Zero dataset.
The Zero dataset is a simple task of predicting zero from zero. This dataset is useful for
integration testing. The extreme simplicity of the dataset allows for models to learn the task
quickly allowing for quick end-to-end testing.
Args:
train (bool, optional): If to lo... | [
"Load",
"the",
"Zero",
"dataset",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/datasets/zero.py#L4-L41 | train | Load the Zero dataset. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/text/subword_encoder.py | SubwordEncoder.decode | def decode(self, encoded):
""" Decodes a tensor into a sequence.
Args:
encoded (torch.Tensor): Encoded sequence.
Returns:
str: Sequence decoded from ``encoded``.
"""
encoded = super().decode(encoded)
return self.tokenizer.decode([self.itos[index]... | python | def decode(self, encoded):
""" Decodes a tensor into a sequence.
Args:
encoded (torch.Tensor): Encoded sequence.
Returns:
str: Sequence decoded from ``encoded``.
"""
encoded = super().decode(encoded)
return self.tokenizer.decode([self.itos[index]... | [
"def",
"decode",
"(",
"self",
",",
"encoded",
")",
":",
"encoded",
"=",
"super",
"(",
")",
".",
"decode",
"(",
"encoded",
")",
"return",
"self",
".",
"tokenizer",
".",
"decode",
"(",
"[",
"self",
".",
"itos",
"[",
"index",
"]",
"for",
"index",
"in"... | Decodes a tensor into a sequence.
Args:
encoded (torch.Tensor): Encoded sequence.
Returns:
str: Sequence decoded from ``encoded``. | [
"Decodes",
"a",
"tensor",
"into",
"a",
"sequence",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/subword_encoder.py#L111-L121 | train | Decodes a tensor into a sequence. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/label_encoder.py | LabelEncoder.encode | def encode(self, label):
""" Encodes a ``label``.
Args:
label (object): Label to encode.
Returns:
torch.Tensor: Encoding of the label.
"""
label = super().encode(label)
return torch.tensor(self.stoi.get(label, self.unknown_index)) | python | def encode(self, label):
""" Encodes a ``label``.
Args:
label (object): Label to encode.
Returns:
torch.Tensor: Encoding of the label.
"""
label = super().encode(label)
return torch.tensor(self.stoi.get(label, self.unknown_index)) | [
"def",
"encode",
"(",
"self",
",",
"label",
")",
":",
"label",
"=",
"super",
"(",
")",
".",
"encode",
"(",
"label",
")",
"return",
"torch",
".",
"tensor",
"(",
"self",
".",
"stoi",
".",
"get",
"(",
"label",
",",
"self",
".",
"unknown_index",
")",
... | Encodes a ``label``.
Args:
label (object): Label to encode.
Returns:
torch.Tensor: Encoding of the label. | [
"Encodes",
"a",
"label",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/label_encoder.py#L76-L87 | train | Encodes a label into a new version of the label. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/label_encoder.py | LabelEncoder.batch_encode | def batch_encode(self, iterator, *args, dim=0, **kwargs):
"""
Args:
iterator (iterator): Batch of labels to encode.
*args: Arguments passed to ``Encoder.batch_encode``.
dim (int, optional): Dimension along which to concatenate tensors.
**kwargs: Keyword ar... | python | def batch_encode(self, iterator, *args, dim=0, **kwargs):
"""
Args:
iterator (iterator): Batch of labels to encode.
*args: Arguments passed to ``Encoder.batch_encode``.
dim (int, optional): Dimension along which to concatenate tensors.
**kwargs: Keyword ar... | [
"def",
"batch_encode",
"(",
"self",
",",
"iterator",
",",
"*",
"args",
",",
"dim",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"torch",
".",
"stack",
"(",
"super",
"(",
")",
".",
"batch_encode",
"(",
"iterator",
",",
"*",
"args",
",",
... | Args:
iterator (iterator): Batch of labels to encode.
*args: Arguments passed to ``Encoder.batch_encode``.
dim (int, optional): Dimension along which to concatenate tensors.
**kwargs: Keyword arguments passed to ``Encoder.batch_encode``.
Returns:
torc... | [
"Args",
":",
"iterator",
"(",
"iterator",
")",
":",
"Batch",
"of",
"labels",
"to",
"encode",
".",
"*",
"args",
":",
"Arguments",
"passed",
"to",
"Encoder",
".",
"batch_encode",
".",
"dim",
"(",
"int",
"optional",
")",
":",
"Dimension",
"along",
"which",
... | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/label_encoder.py#L89-L100 | train | Returns a batch of encoded labels. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/label_encoder.py | LabelEncoder.decode | def decode(self, encoded):
""" Decodes ``encoded`` label.
Args:
encoded (torch.Tensor): Encoded label.
Returns:
object: Label decoded from ``encoded``.
"""
encoded = super().decode(encoded)
if encoded.numel() > 1:
raise ValueError(
... | python | def decode(self, encoded):
""" Decodes ``encoded`` label.
Args:
encoded (torch.Tensor): Encoded label.
Returns:
object: Label decoded from ``encoded``.
"""
encoded = super().decode(encoded)
if encoded.numel() > 1:
raise ValueError(
... | [
"def",
"decode",
"(",
"self",
",",
"encoded",
")",
":",
"encoded",
"=",
"super",
"(",
")",
".",
"decode",
"(",
"encoded",
")",
"if",
"encoded",
".",
"numel",
"(",
")",
">",
"1",
":",
"raise",
"ValueError",
"(",
"'``decode`` decodes one label at a time, use... | Decodes ``encoded`` label.
Args:
encoded (torch.Tensor): Encoded label.
Returns:
object: Label decoded from ``encoded``. | [
"Decodes",
"encoded",
"label",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/label_encoder.py#L102-L117 | train | Decodes an encoded label. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
PetrochukM/PyTorch-NLP | torchnlp/encoders/label_encoder.py | LabelEncoder.batch_decode | def batch_decode(self, tensor, *args, dim=0, **kwargs):
"""
Args:
tensor (torch.Tensor): Batch of tensors.
*args: Arguments passed to ``Encoder.batch_decode``.
dim (int, optional): Dimension along which to split tensors.
**kwargs: Keyword arguments passed ... | python | def batch_decode(self, tensor, *args, dim=0, **kwargs):
"""
Args:
tensor (torch.Tensor): Batch of tensors.
*args: Arguments passed to ``Encoder.batch_decode``.
dim (int, optional): Dimension along which to split tensors.
**kwargs: Keyword arguments passed ... | [
"def",
"batch_decode",
"(",
"self",
",",
"tensor",
",",
"*",
"args",
",",
"dim",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
")",
".",
"batch_decode",
"(",
"[",
"t",
".",
"squeeze",
"(",
"0",
")",
"for",
"t",
"in",
"ten... | Args:
tensor (torch.Tensor): Batch of tensors.
*args: Arguments passed to ``Encoder.batch_decode``.
dim (int, optional): Dimension along which to split tensors.
**kwargs: Keyword arguments passed to ``Encoder.batch_decode``.
Returns:
list: Batch of de... | [
"Args",
":",
"tensor",
"(",
"torch",
".",
"Tensor",
")",
":",
"Batch",
"of",
"tensors",
".",
"*",
"args",
":",
"Arguments",
"passed",
"to",
"Encoder",
".",
"batch_decode",
".",
"dim",
"(",
"int",
"optional",
")",
":",
"Dimension",
"along",
"which",
"to... | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/label_encoder.py#L119-L130 | train | Batch decoding of a single object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
PetrochukM/PyTorch-NLP | torchnlp/datasets/count.py | count_dataset | def count_dataset(train=False,
dev=False,
test=False,
train_rows=10000,
dev_rows=1000,
test_rows=1000,
seq_max_length=10):
"""
Load the Count dataset.
The Count dataset is a simple task of counting t... | python | def count_dataset(train=False,
dev=False,
test=False,
train_rows=10000,
dev_rows=1000,
test_rows=1000,
seq_max_length=10):
"""
Load the Count dataset.
The Count dataset is a simple task of counting t... | [
"def",
"count_dataset",
"(",
"train",
"=",
"False",
",",
"dev",
"=",
"False",
",",
"test",
"=",
"False",
",",
"train_rows",
"=",
"10000",
",",
"dev_rows",
"=",
"1000",
",",
"test_rows",
"=",
"1000",
",",
"seq_max_length",
"=",
"10",
")",
":",
"ret",
... | Load the Count dataset.
The Count dataset is a simple task of counting the number of integers in a sequence. This
dataset is useful for testing implementations of sequence to label models.
Args:
train (bool, optional): If to load the training split of the dataset.
dev (bool, optional): If ... | [
"Load",
"the",
"Count",
"dataset",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/datasets/count.py#L6-L64 | train | Load the Count dataset. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
PetrochukM/PyTorch-NLP | torchnlp/datasets/multi30k.py | multi30k_dataset | def multi30k_dataset(directory='data/multi30k/',
train=False,
dev=False,
test=False,
train_filename='train',
dev_filename='val',
test_filename='test',
check_files=['train.de... | python | def multi30k_dataset(directory='data/multi30k/',
train=False,
dev=False,
test=False,
train_filename='train',
dev_filename='val',
test_filename='test',
check_files=['train.de... | [
"def",
"multi30k_dataset",
"(",
"directory",
"=",
"'data/multi30k/'",
",",
"train",
"=",
"False",
",",
"dev",
"=",
"False",
",",
"test",
"=",
"False",
",",
"train_filename",
"=",
"'train'",
",",
"dev_filename",
"=",
"'val'",
",",
"test_filename",
"=",
"'test... | Load the WMT 2016 machine translation dataset.
As a translation task, this task consists in translating English sentences that describe an
image into German, given the English sentence itself. As training and development data, we
provide 29,000 and 1,014 triples respectively, each containing an English sou... | [
"Load",
"the",
"WMT",
"2016",
"machine",
"translation",
"dataset",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/datasets/multi30k.py#L7-L100 | train | Load the multi30k dataset. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
PetrochukM/PyTorch-NLP | torchnlp/datasets/penn_treebank.py | penn_treebank_dataset | def penn_treebank_dataset(
directory='data/penn-treebank',
train=False,
dev=False,
test=False,
train_filename='ptb.train.txt',
dev_filename='ptb.valid.txt',
test_filename='ptb.test.txt',
check_files=['ptb.train.txt'],
urls=[
'https://ra... | python | def penn_treebank_dataset(
directory='data/penn-treebank',
train=False,
dev=False,
test=False,
train_filename='ptb.train.txt',
dev_filename='ptb.valid.txt',
test_filename='ptb.test.txt',
check_files=['ptb.train.txt'],
urls=[
'https://ra... | [
"def",
"penn_treebank_dataset",
"(",
"directory",
"=",
"'data/penn-treebank'",
",",
"train",
"=",
"False",
",",
"dev",
"=",
"False",
",",
"test",
"=",
"False",
",",
"train_filename",
"=",
"'ptb.train.txt'",
",",
"dev_filename",
"=",
"'ptb.valid.txt'",
",",
"test... | Load the Penn Treebank dataset.
This is the Penn Treebank Project: Release 2 CDROM, featuring a million words of 1989 Wall
Street Journal material.
**Reference:** https://catalog.ldc.upenn.edu/ldc99t42
**Citation:**
Marcus, Mitchell P., Marcinkiewicz, Mary Ann & Santorini, Beatrice (1993).
Bu... | [
"Load",
"the",
"Penn",
"Treebank",
"dataset",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/datasets/penn_treebank.py#L9-L80 | train | Loads a Penn Treebank dataset. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
PetrochukM/PyTorch-NLP | examples/awd-lstm-lm/utils.py | repackage_hidden | def repackage_hidden(h):
"""Wraps hidden states in new Tensors, to detach them from their history."""
if isinstance(h, torch.Tensor):
return h.detach()
else:
return tuple(repackage_hidden(v) for v in h) | python | def repackage_hidden(h):
"""Wraps hidden states in new Tensors, to detach them from their history."""
if isinstance(h, torch.Tensor):
return h.detach()
else:
return tuple(repackage_hidden(v) for v in h) | [
"def",
"repackage_hidden",
"(",
"h",
")",
":",
"if",
"isinstance",
"(",
"h",
",",
"torch",
".",
"Tensor",
")",
":",
"return",
"h",
".",
"detach",
"(",
")",
"else",
":",
"return",
"tuple",
"(",
"repackage_hidden",
"(",
"v",
")",
"for",
"v",
"in",
"h... | Wraps hidden states in new Tensors, to detach them from their history. | [
"Wraps",
"hidden",
"states",
"in",
"new",
"Tensors",
"to",
"detach",
"them",
"from",
"their",
"history",
"."
] | 5f7320da5c8d781df072fab3f7e421c6347e5bfa | https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/examples/awd-lstm-lm/utils.py#L4-L9 | train | Wraps hidden states in new Tensors to detach them from their history. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ethereum/vyper | vyper/parser/parser.py | parse_to_ast | def parse_to_ast(source_code: str) -> List[ast.stmt]:
"""
Parses the given vyper source code and returns a list of python AST objects
for all statements in the source. Performs pre-processing of source code
before parsing as well as post-processing of the resulting AST.
:param source_code: The vyp... | python | def parse_to_ast(source_code: str) -> List[ast.stmt]:
"""
Parses the given vyper source code and returns a list of python AST objects
for all statements in the source. Performs pre-processing of source code
before parsing as well as post-processing of the resulting AST.
:param source_code: The vyp... | [
"def",
"parse_to_ast",
"(",
"source_code",
":",
"str",
")",
"->",
"List",
"[",
"ast",
".",
"stmt",
"]",
":",
"class_types",
",",
"reformatted_code",
"=",
"pre_parse",
"(",
"source_code",
")",
"if",
"'\\x00'",
"in",
"reformatted_code",
":",
"raise",
"ParserEx... | Parses the given vyper source code and returns a list of python AST objects
for all statements in the source. Performs pre-processing of source code
before parsing as well as post-processing of the resulting AST.
:param source_code: The vyper source code to be parsed.
:return: The post-processed list ... | [
"Parses",
"the",
"given",
"vyper",
"source",
"code",
"and",
"returns",
"a",
"list",
"of",
"python",
"AST",
"objects",
"for",
"all",
"statements",
"in",
"the",
"source",
".",
"Performs",
"pre",
"-",
"processing",
"of",
"source",
"code",
"before",
"parsing",
... | c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd | https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/parser.py#L79-L97 | train | Parses the given vyper source code and returns a list of python AST objects for each statement in the source code. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ethereum/vyper | vyper/parser/parser.py | pack_args_by_32 | def pack_args_by_32(holder, maxlen, arg, typ, context, placeholder,
dynamic_offset_counter=None, datamem_start=None, zero_pad_i=None, pos=None):
"""
Copy necessary variables to pre-allocated memory section.
:param holder: Complete holder for all args
:param maxlen: Total length in b... | python | def pack_args_by_32(holder, maxlen, arg, typ, context, placeholder,
dynamic_offset_counter=None, datamem_start=None, zero_pad_i=None, pos=None):
"""
Copy necessary variables to pre-allocated memory section.
:param holder: Complete holder for all args
:param maxlen: Total length in b... | [
"def",
"pack_args_by_32",
"(",
"holder",
",",
"maxlen",
",",
"arg",
",",
"typ",
",",
"context",
",",
"placeholder",
",",
"dynamic_offset_counter",
"=",
"None",
",",
"datamem_start",
"=",
"None",
",",
"zero_pad_i",
"=",
"None",
",",
"pos",
"=",
"None",
")",... | Copy necessary variables to pre-allocated memory section.
:param holder: Complete holder for all args
:param maxlen: Total length in bytes of the full arg section (static + dynamic).
:param arg: Current arg to pack
:param context: Context of arg
:param placeholder: Static placeholder for static arg... | [
"Copy",
"necessary",
"variables",
"to",
"pre",
"-",
"allocated",
"memory",
"section",
"."
] | c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd | https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/parser.py#L758-L891 | train | Packs the arguments into a new memory section. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ethereum/vyper | vyper/parser/pre_parser.py | validate_version_pragma | def validate_version_pragma(version_str: str, start: ParserPosition) -> None:
"""
Validates a version pragma directive against the current compiler version.
"""
from vyper import (
__version__,
)
version_arr = version_str.split('@version')
file_version = version_arr[1].strip()
... | python | def validate_version_pragma(version_str: str, start: ParserPosition) -> None:
"""
Validates a version pragma directive against the current compiler version.
"""
from vyper import (
__version__,
)
version_arr = version_str.split('@version')
file_version = version_arr[1].strip()
... | [
"def",
"validate_version_pragma",
"(",
"version_str",
":",
"str",
",",
"start",
":",
"ParserPosition",
")",
"->",
"None",
":",
"from",
"vyper",
"import",
"(",
"__version__",
",",
")",
"version_arr",
"=",
"version_str",
".",
"split",
"(",
"'@version'",
")",
"... | Validates a version pragma directive against the current compiler version. | [
"Validates",
"a",
"version",
"pragma",
"directive",
"against",
"the",
"current",
"compiler",
"version",
"."
] | c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd | https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/pre_parser.py#L41-L60 | train | Validates a version pragma directive against the current compiler version. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ethereum/vyper | vyper/parser/pre_parser.py | pre_parse | def pre_parse(code: str) -> Tuple[ClassTypes, str]:
"""
Re-formats a vyper source string into a python source string and performs
some validation. More specifically,
* Translates "contract" and "struct" keyword into python "class" keyword
* Validates "@version" pragma against current compiler vers... | python | def pre_parse(code: str) -> Tuple[ClassTypes, str]:
"""
Re-formats a vyper source string into a python source string and performs
some validation. More specifically,
* Translates "contract" and "struct" keyword into python "class" keyword
* Validates "@version" pragma against current compiler vers... | [
"def",
"pre_parse",
"(",
"code",
":",
"str",
")",
"->",
"Tuple",
"[",
"ClassTypes",
",",
"str",
"]",
":",
"result",
"=",
"[",
"]",
"previous_keyword",
"=",
"None",
"class_types",
":",
"ClassTypes",
"=",
"{",
"}",
"try",
":",
"code_bytes",
"=",
"code",
... | Re-formats a vyper source string into a python source string and performs
some validation. More specifically,
* Translates "contract" and "struct" keyword into python "class" keyword
* Validates "@version" pragma against current compiler version
* Prevents direct use of python "class" keyword
* Pr... | [
"Re",
"-",
"formats",
"a",
"vyper",
"source",
"string",
"into",
"a",
"python",
"source",
"string",
"and",
"performs",
"some",
"validation",
".",
"More",
"specifically"
] | c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd | https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/pre_parser.py#L69-L131 | train | Re - formats a vyper source string into a python source string and performs some validation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ethereum/vyper | vyper/parser/global_context.py | GlobalContext.is_valid_varname | def is_valid_varname(self, name, item):
""" Valid variable name, checked against global context. """
check_valid_varname(name, self._custom_units, self._structs, self._constants, item)
if name in self._globals:
raise VariableDeclarationException(
'Invalid name "%s", p... | python | def is_valid_varname(self, name, item):
""" Valid variable name, checked against global context. """
check_valid_varname(name, self._custom_units, self._structs, self._constants, item)
if name in self._globals:
raise VariableDeclarationException(
'Invalid name "%s", p... | [
"def",
"is_valid_varname",
"(",
"self",
",",
"name",
",",
"item",
")",
":",
"check_valid_varname",
"(",
"name",
",",
"self",
".",
"_custom_units",
",",
"self",
".",
"_structs",
",",
"self",
".",
"_constants",
",",
"item",
")",
"if",
"name",
"in",
"self",... | Valid variable name, checked against global context. | [
"Valid",
"variable",
"name",
"checked",
"against",
"global",
"context",
"."
] | c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd | https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/global_context.py#L330-L337 | train | Check if a variable name is valid. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ethereum/vyper | vyper/parser/global_context.py | GlobalContext.get_nonrentrant_counter | def get_nonrentrant_counter(self, key):
"""
Nonrentrant locks use a prefix with a counter to minimise deployment cost of a contract.
"""
prefix = NONRENTRANT_STORAGE_OFFSET
if key in self._nonrentrant_keys:
return self._nonrentrant_keys[key]
else:
... | python | def get_nonrentrant_counter(self, key):
"""
Nonrentrant locks use a prefix with a counter to minimise deployment cost of a contract.
"""
prefix = NONRENTRANT_STORAGE_OFFSET
if key in self._nonrentrant_keys:
return self._nonrentrant_keys[key]
else:
... | [
"def",
"get_nonrentrant_counter",
"(",
"self",
",",
"key",
")",
":",
"prefix",
"=",
"NONRENTRANT_STORAGE_OFFSET",
"if",
"key",
"in",
"self",
".",
"_nonrentrant_keys",
":",
"return",
"self",
".",
"_nonrentrant_keys",
"[",
"key",
"]",
"else",
":",
"counter",
"="... | Nonrentrant locks use a prefix with a counter to minimise deployment cost of a contract. | [
"Nonrentrant",
"locks",
"use",
"a",
"prefix",
"with",
"a",
"counter",
"to",
"minimise",
"deployment",
"cost",
"of",
"a",
"contract",
"."
] | c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd | https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/global_context.py#L507-L519 | train | Get the counter for a nonrentrant lock. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ethereum/vyper | vyper/parser/stmt.py | Stmt._is_list_iter | def _is_list_iter(self):
"""
Test if the current statement is a type of list, used in for loops.
"""
# Check for literal or memory list.
iter_var_type = (
self.context.vars.get(self.stmt.iter.id).typ
if isinstance(self.stmt.iter, ast.Name)
els... | python | def _is_list_iter(self):
"""
Test if the current statement is a type of list, used in for loops.
"""
# Check for literal or memory list.
iter_var_type = (
self.context.vars.get(self.stmt.iter.id).typ
if isinstance(self.stmt.iter, ast.Name)
els... | [
"def",
"_is_list_iter",
"(",
"self",
")",
":",
"# Check for literal or memory list.",
"iter_var_type",
"=",
"(",
"self",
".",
"context",
".",
"vars",
".",
"get",
"(",
"self",
".",
"stmt",
".",
"iter",
".",
"id",
")",
".",
"typ",
"if",
"isinstance",
"(",
... | Test if the current statement is a type of list, used in for loops. | [
"Test",
"if",
"the",
"current",
"statement",
"is",
"a",
"type",
"of",
"list",
"used",
"in",
"for",
"loops",
"."
] | c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd | https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/stmt.py#L586-L606 | train | Test if the current statement is a type of list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ethereum/vyper | vyper/parser/constants.py | Constants.get_constant | def get_constant(self, const_name, context):
""" Return unrolled const """
# check if value is compatible with
const = self._constants[const_name]
if isinstance(const, ast.AnnAssign): # Handle ByteArrays.
if context:
expr = Expr(const.value, context).lll_no... | python | def get_constant(self, const_name, context):
""" Return unrolled const """
# check if value is compatible with
const = self._constants[const_name]
if isinstance(const, ast.AnnAssign): # Handle ByteArrays.
if context:
expr = Expr(const.value, context).lll_no... | [
"def",
"get_constant",
"(",
"self",
",",
"const_name",
",",
"context",
")",
":",
"# check if value is compatible with",
"const",
"=",
"self",
".",
"_constants",
"[",
"const_name",
"]",
"if",
"isinstance",
"(",
"const",
",",
"ast",
".",
"AnnAssign",
")",
":",
... | Return unrolled const | [
"Return",
"unrolled",
"const"
] | c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd | https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/constants.py#L124-L140 | train | Return unrolled const | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ethereum/vyper | vyper/signatures/function_signature.py | FunctionSignature.lookup_sig | def lookup_sig(cls, sigs, method_name, expr_args, stmt_or_expr, context):
"""
Using a list of args, determine the most accurate signature to use from
the given context
"""
def synonymise(s):
return s.replace('int128', 'num').replace('uint256', 'num')
# for s... | python | def lookup_sig(cls, sigs, method_name, expr_args, stmt_or_expr, context):
"""
Using a list of args, determine the most accurate signature to use from
the given context
"""
def synonymise(s):
return s.replace('int128', 'num').replace('uint256', 'num')
# for s... | [
"def",
"lookup_sig",
"(",
"cls",
",",
"sigs",
",",
"method_name",
",",
"expr_args",
",",
"stmt_or_expr",
",",
"context",
")",
":",
"def",
"synonymise",
"(",
"s",
")",
":",
"return",
"s",
".",
"replace",
"(",
"'int128'",
",",
"'num'",
")",
".",
"replace... | Using a list of args, determine the most accurate signature to use from
the given context | [
"Using",
"a",
"list",
"of",
"args",
"determine",
"the",
"most",
"accurate",
"signature",
"to",
"use",
"from",
"the",
"given",
"context"
] | c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd | https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/signatures/function_signature.py#L317-L366 | train | Look up the most accurate signature for a given method name in a given context. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ethereum/vyper | vyper/parser/parser_utils.py | annotate_and_optimize_ast | def annotate_and_optimize_ast(
parsed_ast: ast.Module,
source_code: str,
class_types: Optional[ClassTypes] = None,
) -> None:
"""
Performs annotation and optimization on a parsed python AST by doing the
following:
* Annotating all AST nodes with the originating source code of the AST
* ... | python | def annotate_and_optimize_ast(
parsed_ast: ast.Module,
source_code: str,
class_types: Optional[ClassTypes] = None,
) -> None:
"""
Performs annotation and optimization on a parsed python AST by doing the
following:
* Annotating all AST nodes with the originating source code of the AST
* ... | [
"def",
"annotate_and_optimize_ast",
"(",
"parsed_ast",
":",
"ast",
".",
"Module",
",",
"source_code",
":",
"str",
",",
"class_types",
":",
"Optional",
"[",
"ClassTypes",
"]",
"=",
"None",
",",
")",
"->",
"None",
":",
"AnnotatingVisitor",
"(",
"source_code",
... | Performs annotation and optimization on a parsed python AST by doing the
following:
* Annotating all AST nodes with the originating source code of the AST
* Annotating class definition nodes with their original class type
("contract" or "struct")
* Substituting negative values for unary subtracti... | [
"Performs",
"annotation",
"and",
"optimization",
"on",
"a",
"parsed",
"python",
"AST",
"by",
"doing",
"the",
"following",
":"
] | c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd | https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/parser_utils.py#L833-L854 | train | Annotates the parsed python AST with the source code of the source code. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ethereum/vyper | vyper/utils.py | check_valid_varname | def check_valid_varname(varname,
custom_units,
custom_structs,
constants,
pos,
error_prefix="Variable name invalid.",
exc=None):
""" Handle invalid variable names """
e... | python | def check_valid_varname(varname,
custom_units,
custom_structs,
constants,
pos,
error_prefix="Variable name invalid.",
exc=None):
""" Handle invalid variable names """
e... | [
"def",
"check_valid_varname",
"(",
"varname",
",",
"custom_units",
",",
"custom_structs",
",",
"constants",
",",
"pos",
",",
"error_prefix",
"=",
"\"Variable name invalid.\"",
",",
"exc",
"=",
"None",
")",
":",
"exc",
"=",
"VariableDeclarationException",
"if",
"ex... | Handle invalid variable names | [
"Handle",
"invalid",
"variable",
"names"
] | c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd | https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/utils.py#L242-L256 | train | Check if a variable name is valid. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcpeerconnection.py | allocate_mid | def allocate_mid(mids):
"""
Allocate a MID which has not been used yet.
"""
i = 0
while True:
mid = str(i)
if mid not in mids:
mids.add(mid)
return mid
i += 1 | python | def allocate_mid(mids):
"""
Allocate a MID which has not been used yet.
"""
i = 0
while True:
mid = str(i)
if mid not in mids:
mids.add(mid)
return mid
i += 1 | [
"def",
"allocate_mid",
"(",
"mids",
")",
":",
"i",
"=",
"0",
"while",
"True",
":",
"mid",
"=",
"str",
"(",
"i",
")",
"if",
"mid",
"not",
"in",
"mids",
":",
"mids",
".",
"add",
"(",
"mid",
")",
"return",
"mid",
"i",
"+=",
"1"
] | Allocate a MID which has not been used yet. | [
"Allocate",
"a",
"MID",
"which",
"has",
"not",
"been",
"used",
"yet",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L128-L138 | train | Allocate a MID which has not been used yet. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcpeerconnection.py | RTCPeerConnection.addIceCandidate | def addIceCandidate(self, candidate):
"""
Add a new :class:`RTCIceCandidate` received from the remote peer.
The specified candidate must have a value for either `sdpMid` or `sdpMLineIndex`.
"""
if candidate.sdpMid is None and candidate.sdpMLineIndex is None:
raise Va... | python | def addIceCandidate(self, candidate):
"""
Add a new :class:`RTCIceCandidate` received from the remote peer.
The specified candidate must have a value for either `sdpMid` or `sdpMLineIndex`.
"""
if candidate.sdpMid is None and candidate.sdpMLineIndex is None:
raise Va... | [
"def",
"addIceCandidate",
"(",
"self",
",",
"candidate",
")",
":",
"if",
"candidate",
".",
"sdpMid",
"is",
"None",
"and",
"candidate",
".",
"sdpMLineIndex",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Candidate must have either sdpMid or sdpMLineIndex'",
")",
... | Add a new :class:`RTCIceCandidate` received from the remote peer.
The specified candidate must have a value for either `sdpMid` or `sdpMLineIndex`. | [
"Add",
"a",
"new",
":",
"class",
":",
"RTCIceCandidate",
"received",
"from",
"the",
"remote",
"peer",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L300-L317 | train | Adds a new RTCIceCandidate received from the remote peer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcpeerconnection.py | RTCPeerConnection.addTrack | def addTrack(self, track):
"""
Add a :class:`MediaStreamTrack` to the set of media tracks which
will be transmitted to the remote peer.
"""
# check state is valid
self.__assertNotClosed()
if track.kind not in ['audio', 'video']:
raise InternalError('In... | python | def addTrack(self, track):
"""
Add a :class:`MediaStreamTrack` to the set of media tracks which
will be transmitted to the remote peer.
"""
# check state is valid
self.__assertNotClosed()
if track.kind not in ['audio', 'video']:
raise InternalError('In... | [
"def",
"addTrack",
"(",
"self",
",",
"track",
")",
":",
"# check state is valid",
"self",
".",
"__assertNotClosed",
"(",
")",
"if",
"track",
".",
"kind",
"not",
"in",
"[",
"'audio'",
",",
"'video'",
"]",
":",
"raise",
"InternalError",
"(",
"'Invalid track ki... | Add a :class:`MediaStreamTrack` to the set of media tracks which
will be transmitted to the remote peer. | [
"Add",
"a",
":",
"class",
":",
"MediaStreamTrack",
"to",
"the",
"set",
"of",
"media",
"tracks",
"which",
"will",
"be",
"transmitted",
"to",
"the",
"remote",
"peer",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L319-L343 | train | Adds a MediaStreamTrack to the set of media tracks which can be transmitted to the remote peer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcpeerconnection.py | RTCPeerConnection.addTransceiver | def addTransceiver(self, trackOrKind, direction='sendrecv'):
"""
Add a new :class:`RTCRtpTransceiver`.
"""
self.__assertNotClosed()
# determine track or kind
if hasattr(trackOrKind, 'kind'):
kind = trackOrKind.kind
track = trackOrKind
else... | python | def addTransceiver(self, trackOrKind, direction='sendrecv'):
"""
Add a new :class:`RTCRtpTransceiver`.
"""
self.__assertNotClosed()
# determine track or kind
if hasattr(trackOrKind, 'kind'):
kind = trackOrKind.kind
track = trackOrKind
else... | [
"def",
"addTransceiver",
"(",
"self",
",",
"trackOrKind",
",",
"direction",
"=",
"'sendrecv'",
")",
":",
"self",
".",
"__assertNotClosed",
"(",
")",
"# determine track or kind",
"if",
"hasattr",
"(",
"trackOrKind",
",",
"'kind'",
")",
":",
"kind",
"=",
"trackO... | Add a new :class:`RTCRtpTransceiver`. | [
"Add",
"a",
"new",
":",
"class",
":",
"RTCRtpTransceiver",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L345-L372 | train | Add a new RTCRtpTransceiver. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcpeerconnection.py | RTCPeerConnection.close | async def close(self):
"""
Terminate the ICE agent, ending ICE processing and streams.
"""
if self.__isClosed:
return
self.__isClosed = True
self.__setSignalingState('closed')
# stop senders / receivers
for transceiver in self.__transceivers:
... | python | async def close(self):
"""
Terminate the ICE agent, ending ICE processing and streams.
"""
if self.__isClosed:
return
self.__isClosed = True
self.__setSignalingState('closed')
# stop senders / receivers
for transceiver in self.__transceivers:
... | [
"async",
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"__isClosed",
":",
"return",
"self",
".",
"__isClosed",
"=",
"True",
"self",
".",
"__setSignalingState",
"(",
"'closed'",
")",
"# stop senders / receivers",
"for",
"transceiver",
"in",
"self",
... | Terminate the ICE agent, ending ICE processing and streams. | [
"Terminate",
"the",
"ICE",
"agent",
"ending",
"ICE",
"processing",
"and",
"streams",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L374-L400 | train | Stop the ICE agent and all its associated sockets. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcpeerconnection.py | RTCPeerConnection.createAnswer | async def createAnswer(self):
"""
Create an SDP answer to an offer received from a remote peer during
the offer/answer negotiation of a WebRTC connection.
:rtype: :class:`RTCSessionDescription`
"""
# check state is valid
self.__assertNotClosed()
if self.s... | python | async def createAnswer(self):
"""
Create an SDP answer to an offer received from a remote peer during
the offer/answer negotiation of a WebRTC connection.
:rtype: :class:`RTCSessionDescription`
"""
# check state is valid
self.__assertNotClosed()
if self.s... | [
"async",
"def",
"createAnswer",
"(",
"self",
")",
":",
"# check state is valid",
"self",
".",
"__assertNotClosed",
"(",
")",
"if",
"self",
".",
"signalingState",
"not",
"in",
"[",
"'have-remote-offer'",
",",
"'have-local-pranswer'",
"]",
":",
"raise",
"InvalidStat... | Create an SDP answer to an offer received from a remote peer during
the offer/answer negotiation of a WebRTC connection.
:rtype: :class:`RTCSessionDescription` | [
"Create",
"an",
"SDP",
"answer",
"to",
"an",
"offer",
"received",
"from",
"a",
"remote",
"peer",
"during",
"the",
"offer",
"/",
"answer",
"negotiation",
"of",
"a",
"WebRTC",
"connection",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L402-L441 | train | Create an SDP answer to an offer received from a remote peer during the offer negotiation of a WebRTC connection. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcpeerconnection.py | RTCPeerConnection.createDataChannel | def createDataChannel(self, label, maxPacketLifeTime=None, maxRetransmits=None,
ordered=True, protocol='', negotiated=False, id=None):
"""
Create a data channel with the given label.
:rtype: :class:`RTCDataChannel`
"""
if maxPacketLifeTime is not None a... | python | def createDataChannel(self, label, maxPacketLifeTime=None, maxRetransmits=None,
ordered=True, protocol='', negotiated=False, id=None):
"""
Create a data channel with the given label.
:rtype: :class:`RTCDataChannel`
"""
if maxPacketLifeTime is not None a... | [
"def",
"createDataChannel",
"(",
"self",
",",
"label",
",",
"maxPacketLifeTime",
"=",
"None",
",",
"maxRetransmits",
"=",
"None",
",",
"ordered",
"=",
"True",
",",
"protocol",
"=",
"''",
",",
"negotiated",
"=",
"False",
",",
"id",
"=",
"None",
")",
":",
... | Create a data channel with the given label.
:rtype: :class:`RTCDataChannel` | [
"Create",
"a",
"data",
"channel",
"with",
"the",
"given",
"label",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L443-L464 | train | Create a new data channel with the given label. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcpeerconnection.py | RTCPeerConnection.createOffer | async def createOffer(self):
"""
Create an SDP offer for the purpose of starting a new WebRTC
connection to a remote peer.
:rtype: :class:`RTCSessionDescription`
"""
# check state is valid
self.__assertNotClosed()
if not self.__sctp and not self.__transc... | python | async def createOffer(self):
"""
Create an SDP offer for the purpose of starting a new WebRTC
connection to a remote peer.
:rtype: :class:`RTCSessionDescription`
"""
# check state is valid
self.__assertNotClosed()
if not self.__sctp and not self.__transc... | [
"async",
"def",
"createOffer",
"(",
"self",
")",
":",
"# check state is valid",
"self",
".",
"__assertNotClosed",
"(",
")",
"if",
"not",
"self",
".",
"__sctp",
"and",
"not",
"self",
".",
"__transceivers",
":",
"raise",
"InternalError",
"(",
"'Cannot create an of... | Create an SDP offer for the purpose of starting a new WebRTC
connection to a remote peer.
:rtype: :class:`RTCSessionDescription` | [
"Create",
"an",
"SDP",
"offer",
"for",
"the",
"purpose",
"of",
"starting",
"a",
"new",
"WebRTC",
"connection",
"to",
"a",
"remote",
"peer",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L466-L546 | train | Create an SDP offer for the purpose of starting a new WebRTC connection to a remote peer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcpeerconnection.py | RTCPeerConnection.getStats | async def getStats(self):
"""
Returns statistics for the connection.
:rtype: :class:`RTCStatsReport`
"""
merged = RTCStatsReport()
coros = [x.getStats() for x in (self.getSenders() + self.getReceivers())]
for report in await asyncio.gather(*coros):
me... | python | async def getStats(self):
"""
Returns statistics for the connection.
:rtype: :class:`RTCStatsReport`
"""
merged = RTCStatsReport()
coros = [x.getStats() for x in (self.getSenders() + self.getReceivers())]
for report in await asyncio.gather(*coros):
me... | [
"async",
"def",
"getStats",
"(",
"self",
")",
":",
"merged",
"=",
"RTCStatsReport",
"(",
")",
"coros",
"=",
"[",
"x",
".",
"getStats",
"(",
")",
"for",
"x",
"in",
"(",
"self",
".",
"getSenders",
"(",
")",
"+",
"self",
".",
"getReceivers",
"(",
")",... | Returns statistics for the connection.
:rtype: :class:`RTCStatsReport` | [
"Returns",
"statistics",
"for",
"the",
"connection",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L562-L572 | train | Returns statistics for the connection. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcpeerconnection.py | RTCPeerConnection.setLocalDescription | async def setLocalDescription(self, sessionDescription):
"""
Change the local description associated with the connection.
:param: sessionDescription: An :class:`RTCSessionDescription` generated
by :meth:`createOffer` or :meth:`createAnswer()`.
"""
... | python | async def setLocalDescription(self, sessionDescription):
"""
Change the local description associated with the connection.
:param: sessionDescription: An :class:`RTCSessionDescription` generated
by :meth:`createOffer` or :meth:`createAnswer()`.
"""
... | [
"async",
"def",
"setLocalDescription",
"(",
"self",
",",
"sessionDescription",
")",
":",
"# parse and validate description",
"description",
"=",
"sdp",
".",
"SessionDescription",
".",
"parse",
"(",
"sessionDescription",
".",
"sdp",
")",
"description",
".",
"type",
"... | Change the local description associated with the connection.
:param: sessionDescription: An :class:`RTCSessionDescription` generated
by :meth:`createOffer` or :meth:`createAnswer()`. | [
"Change",
"the",
"local",
"description",
"associated",
"with",
"the",
"connection",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L581-L637 | train | Change the local description associated with the connection. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcpeerconnection.py | RTCPeerConnection.setRemoteDescription | async def setRemoteDescription(self, sessionDescription):
"""
Changes the remote description associated with the connection.
:param: sessionDescription: An :class:`RTCSessionDescription` created from
information received over the signaling channel.
""... | python | async def setRemoteDescription(self, sessionDescription):
"""
Changes the remote description associated with the connection.
:param: sessionDescription: An :class:`RTCSessionDescription` created from
information received over the signaling channel.
""... | [
"async",
"def",
"setRemoteDescription",
"(",
"self",
",",
"sessionDescription",
")",
":",
"# parse and validate description",
"description",
"=",
"sdp",
".",
"SessionDescription",
".",
"parse",
"(",
"sessionDescription",
".",
"sdp",
")",
"description",
".",
"type",
... | Changes the remote description associated with the connection.
:param: sessionDescription: An :class:`RTCSessionDescription` created from
information received over the signaling channel. | [
"Changes",
"the",
"remote",
"description",
"associated",
"with",
"the",
"connection",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L639-L774 | train | This method is used to set the remote description associated with the connection. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtp.py | pack_remb_fci | def pack_remb_fci(bitrate, ssrcs):
"""
Pack the FCI for a Receiver Estimated Maximum Bitrate report.
https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03
"""
data = b'REMB'
exponent = 0
mantissa = bitrate
while mantissa > 0x3ffff:
mantissa >>= 1
exponent += 1
d... | python | def pack_remb_fci(bitrate, ssrcs):
"""
Pack the FCI for a Receiver Estimated Maximum Bitrate report.
https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03
"""
data = b'REMB'
exponent = 0
mantissa = bitrate
while mantissa > 0x3ffff:
mantissa >>= 1
exponent += 1
d... | [
"def",
"pack_remb_fci",
"(",
"bitrate",
",",
"ssrcs",
")",
":",
"data",
"=",
"b'REMB'",
"exponent",
"=",
"0",
"mantissa",
"=",
"bitrate",
"while",
"mantissa",
">",
"0x3ffff",
":",
"mantissa",
">>=",
"1",
"exponent",
"+=",
"1",
"data",
"+=",
"pack",
"(",
... | Pack the FCI for a Receiver Estimated Maximum Bitrate report.
https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03 | [
"Pack",
"the",
"FCI",
"for",
"a",
"Receiver",
"Estimated",
"Maximum",
"Bitrate",
"report",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtp.py#L150-L168 | train | Pack the FCI for a Receiver Estimated Maximum Bitrate report. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtp.py | unpack_remb_fci | def unpack_remb_fci(data):
"""
Unpack the FCI for a Receiver Estimated Maximum Bitrate report.
https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03
"""
if len(data) < 8 or data[0:4] != b'REMB':
raise ValueError('Invalid REMB prefix')
exponent = (data[5] & 0xfc) >> 2
mantissa ... | python | def unpack_remb_fci(data):
"""
Unpack the FCI for a Receiver Estimated Maximum Bitrate report.
https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03
"""
if len(data) < 8 or data[0:4] != b'REMB':
raise ValueError('Invalid REMB prefix')
exponent = (data[5] & 0xfc) >> 2
mantissa ... | [
"def",
"unpack_remb_fci",
"(",
"data",
")",
":",
"if",
"len",
"(",
"data",
")",
"<",
"8",
"or",
"data",
"[",
"0",
":",
"4",
"]",
"!=",
"b'REMB'",
":",
"raise",
"ValueError",
"(",
"'Invalid REMB prefix'",
")",
"exponent",
"=",
"(",
"data",
"[",
"5",
... | Unpack the FCI for a Receiver Estimated Maximum Bitrate report.
https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03 | [
"Unpack",
"the",
"FCI",
"for",
"a",
"Receiver",
"Estimated",
"Maximum",
"Bitrate",
"report",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtp.py#L171-L190 | train | Unpack the FCI for a Receiver Estimated Maximum Bitrate report. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtp.py | unpack_header_extensions | def unpack_header_extensions(extension_profile: int,
extension_value: bytes) -> List[Tuple[int, bytes]]:
"""
Parse header extensions according to RFC 5285.
"""
extensions = []
pos = 0
if extension_profile == 0xBEDE:
# One-Byte Header
while pos < len(... | python | def unpack_header_extensions(extension_profile: int,
extension_value: bytes) -> List[Tuple[int, bytes]]:
"""
Parse header extensions according to RFC 5285.
"""
extensions = []
pos = 0
if extension_profile == 0xBEDE:
# One-Byte Header
while pos < len(... | [
"def",
"unpack_header_extensions",
"(",
"extension_profile",
":",
"int",
",",
"extension_value",
":",
"bytes",
")",
"->",
"List",
"[",
"Tuple",
"[",
"int",
",",
"bytes",
"]",
"]",
":",
"extensions",
"=",
"[",
"]",
"pos",
"=",
"0",
"if",
"extension_profile"... | Parse header extensions according to RFC 5285. | [
"Parse",
"header",
"extensions",
"according",
"to",
"RFC",
"5285",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtp.py#L204-L248 | train | Parse header extensions according to RFC 5285. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtp.py | pack_header_extensions | def pack_header_extensions(extensions: List[Tuple[int, bytes]]) -> Tuple[int, bytes]:
"""
Serialize header extensions according to RFC 5285.
"""
extension_profile = 0
extension_value = b''
if not extensions:
return extension_profile, extension_value
one_byte = True
for x_id, x_... | python | def pack_header_extensions(extensions: List[Tuple[int, bytes]]) -> Tuple[int, bytes]:
"""
Serialize header extensions according to RFC 5285.
"""
extension_profile = 0
extension_value = b''
if not extensions:
return extension_profile, extension_value
one_byte = True
for x_id, x_... | [
"def",
"pack_header_extensions",
"(",
"extensions",
":",
"List",
"[",
"Tuple",
"[",
"int",
",",
"bytes",
"]",
"]",
")",
"->",
"Tuple",
"[",
"int",
",",
"bytes",
"]",
":",
"extension_profile",
"=",
"0",
"extension_value",
"=",
"b''",
"if",
"not",
"extensi... | Serialize header extensions according to RFC 5285. | [
"Serialize",
"header",
"extensions",
"according",
"to",
"RFC",
"5285",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtp.py#L251-L287 | train | Serializes header extensions according to RFC 5285. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtp.py | unwrap_rtx | def unwrap_rtx(rtx, payload_type, ssrc):
"""
Recover initial packet from a retransmission packet.
"""
packet = RtpPacket(
payload_type=payload_type,
marker=rtx.marker,
sequence_number=unpack('!H', rtx.payload[0:2])[0],
timestamp=rtx.timestamp,
ssrc=ssrc,
p... | python | def unwrap_rtx(rtx, payload_type, ssrc):
"""
Recover initial packet from a retransmission packet.
"""
packet = RtpPacket(
payload_type=payload_type,
marker=rtx.marker,
sequence_number=unpack('!H', rtx.payload[0:2])[0],
timestamp=rtx.timestamp,
ssrc=ssrc,
p... | [
"def",
"unwrap_rtx",
"(",
"rtx",
",",
"payload_type",
",",
"ssrc",
")",
":",
"packet",
"=",
"RtpPacket",
"(",
"payload_type",
"=",
"payload_type",
",",
"marker",
"=",
"rtx",
".",
"marker",
",",
"sequence_number",
"=",
"unpack",
"(",
"'!H'",
",",
"rtx",
"... | Recover initial packet from a retransmission packet. | [
"Recover",
"initial",
"packet",
"from",
"a",
"retransmission",
"packet",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtp.py#L290-L303 | train | Recover initial packet from a retransmission packet. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtp.py | wrap_rtx | def wrap_rtx(packet, payload_type, sequence_number, ssrc):
"""
Create a retransmission packet from a lost packet.
"""
rtx = RtpPacket(
payload_type=payload_type,
marker=packet.marker,
sequence_number=sequence_number,
timestamp=packet.timestamp,
ssrc=ssrc,
... | python | def wrap_rtx(packet, payload_type, sequence_number, ssrc):
"""
Create a retransmission packet from a lost packet.
"""
rtx = RtpPacket(
payload_type=payload_type,
marker=packet.marker,
sequence_number=sequence_number,
timestamp=packet.timestamp,
ssrc=ssrc,
... | [
"def",
"wrap_rtx",
"(",
"packet",
",",
"payload_type",
",",
"sequence_number",
",",
"ssrc",
")",
":",
"rtx",
"=",
"RtpPacket",
"(",
"payload_type",
"=",
"payload_type",
",",
"marker",
"=",
"packet",
".",
"marker",
",",
"sequence_number",
"=",
"sequence_number"... | Create a retransmission packet from a lost packet. | [
"Create",
"a",
"retransmission",
"packet",
"from",
"a",
"lost",
"packet",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtp.py#L306-L319 | train | Create a retransmission packet from a lost packet. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcrtpsender.py | RTCRtpSender.getStats | async def getStats(self):
"""
Returns statistics about the RTP sender.
:rtype: :class:`RTCStatsReport`
"""
self.__stats.add(RTCOutboundRtpStreamStats(
# RTCStats
timestamp=clock.current_datetime(),
type='outbound-rtp',
id='outbound... | python | async def getStats(self):
"""
Returns statistics about the RTP sender.
:rtype: :class:`RTCStatsReport`
"""
self.__stats.add(RTCOutboundRtpStreamStats(
# RTCStats
timestamp=clock.current_datetime(),
type='outbound-rtp',
id='outbound... | [
"async",
"def",
"getStats",
"(",
"self",
")",
":",
"self",
".",
"__stats",
".",
"add",
"(",
"RTCOutboundRtpStreamStats",
"(",
"# RTCStats",
"timestamp",
"=",
"clock",
".",
"current_datetime",
"(",
")",
",",
"type",
"=",
"'outbound-rtp'",
",",
"id",
"=",
"'... | Returns statistics about the RTP sender.
:rtype: :class:`RTCStatsReport` | [
"Returns",
"statistics",
"about",
"the",
"RTP",
"sender",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpsender.py#L105-L128 | train | Returns statistics about the RTP sender. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcrtpsender.py | RTCRtpSender.send | async def send(self, parameters: RTCRtpSendParameters):
"""
Attempt to set the parameters controlling the sending of media.
:param: parameters: The :class:`RTCRtpParameters` for the sender.
"""
if not self.__started:
self.__cname = parameters.rtcp.cname
s... | python | async def send(self, parameters: RTCRtpSendParameters):
"""
Attempt to set the parameters controlling the sending of media.
:param: parameters: The :class:`RTCRtpParameters` for the sender.
"""
if not self.__started:
self.__cname = parameters.rtcp.cname
s... | [
"async",
"def",
"send",
"(",
"self",
",",
"parameters",
":",
"RTCRtpSendParameters",
")",
":",
"if",
"not",
"self",
".",
"__started",
":",
"self",
".",
"__cname",
"=",
"parameters",
".",
"rtcp",
".",
"cname",
"self",
".",
"__mid",
"=",
"parameters",
".",... | Attempt to set the parameters controlling the sending of media.
:param: parameters: The :class:`RTCRtpParameters` for the sender. | [
"Attempt",
"to",
"set",
"the",
"parameters",
"controlling",
"the",
"sending",
"of",
"media",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpsender.py#L140-L162 | train | Sends the media to the remote peer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcrtpsender.py | RTCRtpSender.stop | async def stop(self):
"""
Irreversibly stop the sender.
"""
if self.__started:
self.__transport._unregister_rtp_sender(self)
self.__rtp_task.cancel()
self.__rtcp_task.cancel()
await asyncio.gather(
self.__rtp_exited.wait(),
... | python | async def stop(self):
"""
Irreversibly stop the sender.
"""
if self.__started:
self.__transport._unregister_rtp_sender(self)
self.__rtp_task.cancel()
self.__rtcp_task.cancel()
await asyncio.gather(
self.__rtp_exited.wait(),
... | [
"async",
"def",
"stop",
"(",
"self",
")",
":",
"if",
"self",
".",
"__started",
":",
"self",
".",
"__transport",
".",
"_unregister_rtp_sender",
"(",
"self",
")",
"self",
".",
"__rtp_task",
".",
"cancel",
"(",
")",
"self",
".",
"__rtcp_task",
".",
"cancel"... | Irreversibly stop the sender. | [
"Irreversibly",
"stop",
"the",
"sender",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpsender.py#L164-L174 | train | Stop the sender. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcrtpsender.py | RTCRtpSender._retransmit | async def _retransmit(self, sequence_number):
"""
Retransmit an RTP packet which was reported as lost.
"""
packet = self.__rtp_history.get(sequence_number % RTP_HISTORY_SIZE)
if packet and packet.sequence_number == sequence_number:
if self.__rtx_payload_type is not No... | python | async def _retransmit(self, sequence_number):
"""
Retransmit an RTP packet which was reported as lost.
"""
packet = self.__rtp_history.get(sequence_number % RTP_HISTORY_SIZE)
if packet and packet.sequence_number == sequence_number:
if self.__rtx_payload_type is not No... | [
"async",
"def",
"_retransmit",
"(",
"self",
",",
"sequence_number",
")",
":",
"packet",
"=",
"self",
".",
"__rtp_history",
".",
"get",
"(",
"sequence_number",
"%",
"RTP_HISTORY_SIZE",
")",
"if",
"packet",
"and",
"packet",
".",
"sequence_number",
"==",
"sequenc... | Retransmit an RTP packet which was reported as lost. | [
"Retransmit",
"an",
"RTP",
"packet",
"which",
"was",
"reported",
"as",
"lost",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpsender.py#L228-L243 | train | Retransmit an RTP packet which was reported as lost. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/utils.py | uint16_gt | def uint16_gt(a: int, b: int) -> bool:
"""
Return a > b.
"""
half_mod = 0x8000
return (((a < b) and ((b - a) > half_mod)) or
((a > b) and ((a - b) < half_mod))) | python | def uint16_gt(a: int, b: int) -> bool:
"""
Return a > b.
"""
half_mod = 0x8000
return (((a < b) and ((b - a) > half_mod)) or
((a > b) and ((a - b) < half_mod))) | [
"def",
"uint16_gt",
"(",
"a",
":",
"int",
",",
"b",
":",
"int",
")",
"->",
"bool",
":",
"half_mod",
"=",
"0x8000",
"return",
"(",
"(",
"(",
"a",
"<",
"b",
")",
"and",
"(",
"(",
"b",
"-",
"a",
")",
">",
"half_mod",
")",
")",
"or",
"(",
"(",
... | Return a > b. | [
"Return",
"a",
">",
"b",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/utils.py#L20-L26 | train | Return True if uint16_gt a and b. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/utils.py | uint16_gte | def uint16_gte(a: int, b: int) -> bool:
"""
Return a >= b.
"""
return (a == b) or uint16_gt(a, b) | python | def uint16_gte(a: int, b: int) -> bool:
"""
Return a >= b.
"""
return (a == b) or uint16_gt(a, b) | [
"def",
"uint16_gte",
"(",
"a",
":",
"int",
",",
"b",
":",
"int",
")",
"->",
"bool",
":",
"return",
"(",
"a",
"==",
"b",
")",
"or",
"uint16_gt",
"(",
"a",
",",
"b",
")"
] | Return a >= b. | [
"Return",
"a",
">",
"=",
"b",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/utils.py#L29-L33 | train | Return true if uint16_gt a and b are not equal. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/utils.py | uint32_gt | def uint32_gt(a: int, b: int) -> bool:
"""
Return a > b.
"""
half_mod = 0x80000000
return (((a < b) and ((b - a) > half_mod)) or
((a > b) and ((a - b) < half_mod))) | python | def uint32_gt(a: int, b: int) -> bool:
"""
Return a > b.
"""
half_mod = 0x80000000
return (((a < b) and ((b - a) > half_mod)) or
((a > b) and ((a - b) < half_mod))) | [
"def",
"uint32_gt",
"(",
"a",
":",
"int",
",",
"b",
":",
"int",
")",
"->",
"bool",
":",
"half_mod",
"=",
"0x80000000",
"return",
"(",
"(",
"(",
"a",
"<",
"b",
")",
"and",
"(",
"(",
"b",
"-",
"a",
")",
">",
"half_mod",
")",
")",
"or",
"(",
"... | Return a > b. | [
"Return",
"a",
">",
"b",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/utils.py#L43-L49 | train | Return True if uint32_gt a and b. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/utils.py | uint32_gte | def uint32_gte(a: int, b: int) -> bool:
"""
Return a >= b.
"""
return (a == b) or uint32_gt(a, b) | python | def uint32_gte(a: int, b: int) -> bool:
"""
Return a >= b.
"""
return (a == b) or uint32_gt(a, b) | [
"def",
"uint32_gte",
"(",
"a",
":",
"int",
",",
"b",
":",
"int",
")",
"->",
"bool",
":",
"return",
"(",
"a",
"==",
"b",
")",
"or",
"uint32_gt",
"(",
"a",
",",
"b",
")"
] | Return a >= b. | [
"Return",
"a",
">",
"=",
"b",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/utils.py#L52-L56 | train | Return True if uint32_gt a or greater than b. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | examples/datachannel-vpn/tuntap.py | Tun.up | def up(self):
''' Bring up interface. Equivalent to ifconfig [iface] up. '''
# Set new flags
flags = self.ifflags | IFF_UP
self.ifflags = flags
self.get_mtu() | python | def up(self):
''' Bring up interface. Equivalent to ifconfig [iface] up. '''
# Set new flags
flags = self.ifflags | IFF_UP
self.ifflags = flags
self.get_mtu() | [
"def",
"up",
"(",
"self",
")",
":",
"# Set new flags",
"flags",
"=",
"self",
".",
"ifflags",
"|",
"IFF_UP",
"self",
".",
"ifflags",
"=",
"flags",
"self",
".",
"get_mtu",
"(",
")"
] | Bring up interface. Equivalent to ifconfig [iface] up. | [
"Bring",
"up",
"interface",
".",
"Equivalent",
"to",
"ifconfig",
"[",
"iface",
"]",
"up",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/examples/datachannel-vpn/tuntap.py#L69-L74 | train | Bring up interface. Equivalent to ifconfig [ iface up. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | examples/datachannel-vpn/tuntap.py | Tun.open | def open(self):
''' Open file corresponding to the TUN device. '''
self.fd = open('/dev/net/tun', 'rb+', buffering=0)
tun_flags = IFF_TAP | IFF_NO_PI | IFF_PERSIST
ifr = struct.pack('16sH', self.name, tun_flags)
fcntl.ioctl(self.fd, TUNSETIFF, ifr)
fcntl.ioctl(self.fd, TU... | python | def open(self):
''' Open file corresponding to the TUN device. '''
self.fd = open('/dev/net/tun', 'rb+', buffering=0)
tun_flags = IFF_TAP | IFF_NO_PI | IFF_PERSIST
ifr = struct.pack('16sH', self.name, tun_flags)
fcntl.ioctl(self.fd, TUNSETIFF, ifr)
fcntl.ioctl(self.fd, TU... | [
"def",
"open",
"(",
"self",
")",
":",
"self",
".",
"fd",
"=",
"open",
"(",
"'/dev/net/tun'",
",",
"'rb+'",
",",
"buffering",
"=",
"0",
")",
"tun_flags",
"=",
"IFF_TAP",
"|",
"IFF_NO_PI",
"|",
"IFF_PERSIST",
"ifr",
"=",
"struct",
".",
"pack",
"(",
"'1... | Open file corresponding to the TUN device. | [
"Open",
"file",
"corresponding",
"to",
"the",
"TUN",
"device",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/examples/datachannel-vpn/tuntap.py#L90-L97 | train | Open the file corresponding to the TUN device. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcicetransport.py | RTCIceGatherer.gather | async def gather(self):
"""
Gather ICE candidates.
"""
if self.__state == 'new':
self.__setState('gathering')
await self._connection.gather_candidates()
self.__setState('completed') | python | async def gather(self):
"""
Gather ICE candidates.
"""
if self.__state == 'new':
self.__setState('gathering')
await self._connection.gather_candidates()
self.__setState('completed') | [
"async",
"def",
"gather",
"(",
"self",
")",
":",
"if",
"self",
".",
"__state",
"==",
"'new'",
":",
"self",
".",
"__setState",
"(",
"'gathering'",
")",
"await",
"self",
".",
"_connection",
".",
"gather_candidates",
"(",
")",
"self",
".",
"__setState",
"("... | Gather ICE candidates. | [
"Gather",
"ICE",
"candidates",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcicetransport.py#L158-L165 | train | Gather ICE candidates. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcicetransport.py | RTCIceGatherer.getLocalParameters | def getLocalParameters(self):
"""
Retrieve the ICE parameters of the ICE gatherer.
:rtype: RTCIceParameters
"""
return RTCIceParameters(
usernameFragment=self._connection.local_username,
password=self._connection.local_password) | python | def getLocalParameters(self):
"""
Retrieve the ICE parameters of the ICE gatherer.
:rtype: RTCIceParameters
"""
return RTCIceParameters(
usernameFragment=self._connection.local_username,
password=self._connection.local_password) | [
"def",
"getLocalParameters",
"(",
"self",
")",
":",
"return",
"RTCIceParameters",
"(",
"usernameFragment",
"=",
"self",
".",
"_connection",
".",
"local_username",
",",
"password",
"=",
"self",
".",
"_connection",
".",
"local_password",
")"
] | Retrieve the ICE parameters of the ICE gatherer.
:rtype: RTCIceParameters | [
"Retrieve",
"the",
"ICE",
"parameters",
"of",
"the",
"ICE",
"gatherer",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcicetransport.py#L181-L189 | train | Retrieves the ICE parameters of the ICE gatherer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcicetransport.py | RTCIceTransport.addRemoteCandidate | def addRemoteCandidate(self, candidate):
"""
Add a remote candidate.
"""
# FIXME: don't use private member!
if not self._connection._remote_candidates_end:
if candidate is None:
self._connection.add_remote_candidate(None)
else:
... | python | def addRemoteCandidate(self, candidate):
"""
Add a remote candidate.
"""
# FIXME: don't use private member!
if not self._connection._remote_candidates_end:
if candidate is None:
self._connection.add_remote_candidate(None)
else:
... | [
"def",
"addRemoteCandidate",
"(",
"self",
",",
"candidate",
")",
":",
"# FIXME: don't use private member!",
"if",
"not",
"self",
".",
"_connection",
".",
"_remote_candidates_end",
":",
"if",
"candidate",
"is",
"None",
":",
"self",
".",
"_connection",
".",
"add_rem... | Add a remote candidate. | [
"Add",
"a",
"remote",
"candidate",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcicetransport.py#L252-L261 | train | Add a remote candidate to the AIOIC. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcicetransport.py | RTCIceTransport.start | async def start(self, remoteParameters):
"""
Initiate connectivity checks.
:param: remoteParameters: The :class:`RTCIceParameters` associated with
the remote :class:`RTCIceTransport`.
"""
if self.state == 'closed':
raise InvalidState... | python | async def start(self, remoteParameters):
"""
Initiate connectivity checks.
:param: remoteParameters: The :class:`RTCIceParameters` associated with
the remote :class:`RTCIceTransport`.
"""
if self.state == 'closed':
raise InvalidState... | [
"async",
"def",
"start",
"(",
"self",
",",
"remoteParameters",
")",
":",
"if",
"self",
".",
"state",
"==",
"'closed'",
":",
"raise",
"InvalidStateError",
"(",
"'RTCIceTransport is closed'",
")",
"# handle the case where start is already in progress",
"if",
"self",
"."... | Initiate connectivity checks.
:param: remoteParameters: The :class:`RTCIceParameters` associated with
the remote :class:`RTCIceTransport`. | [
"Initiate",
"connectivity",
"checks",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcicetransport.py#L270-L294 | train | Initiate connectivity checks. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcdatachannel.py | RTCDataChannel.send | def send(self, data):
"""
Send `data` across the data channel to the remote peer.
"""
if self.readyState != 'open':
raise InvalidStateError
if not isinstance(data, (str, bytes)):
raise ValueError('Cannot send unsupported data type: %s' % type(data))
... | python | def send(self, data):
"""
Send `data` across the data channel to the remote peer.
"""
if self.readyState != 'open':
raise InvalidStateError
if not isinstance(data, (str, bytes)):
raise ValueError('Cannot send unsupported data type: %s' % type(data))
... | [
"def",
"send",
"(",
"self",
",",
"data",
")",
":",
"if",
"self",
".",
"readyState",
"!=",
"'open'",
":",
"raise",
"InvalidStateError",
"if",
"not",
"isinstance",
"(",
"data",
",",
"(",
"str",
",",
"bytes",
")",
")",
":",
"raise",
"ValueError",
"(",
"... | Send `data` across the data channel to the remote peer. | [
"Send",
"data",
"across",
"the",
"data",
"channel",
"to",
"the",
"remote",
"peer",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcdatachannel.py#L134-L144 | train | Send data across the data channel. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcrtptransceiver.py | RTCRtpTransceiver.setCodecPreferences | def setCodecPreferences(self, codecs):
"""
Override the default codec preferences.
See :meth:`RTCRtpSender.getCapabilities` and :meth:`RTCRtpReceiver.getCapabilities`
for the supported codecs.
:param: codecs: A list of :class:`RTCRtpCodecCapability`, in decreasing order
... | python | def setCodecPreferences(self, codecs):
"""
Override the default codec preferences.
See :meth:`RTCRtpSender.getCapabilities` and :meth:`RTCRtpReceiver.getCapabilities`
for the supported codecs.
:param: codecs: A list of :class:`RTCRtpCodecCapability`, in decreasing order
... | [
"def",
"setCodecPreferences",
"(",
"self",
",",
"codecs",
")",
":",
"if",
"not",
"codecs",
":",
"self",
".",
"_preferred_codecs",
"=",
"[",
"]",
"capabilities",
"=",
"get_capabilities",
"(",
"self",
".",
"kind",
")",
".",
"codecs",
"unique",
"=",
"[",
"]... | Override the default codec preferences.
See :meth:`RTCRtpSender.getCapabilities` and :meth:`RTCRtpReceiver.getCapabilities`
for the supported codecs.
:param: codecs: A list of :class:`RTCRtpCodecCapability`, in decreasing order
of preference. If empty, restores the defa... | [
"Override",
"the",
"default",
"codec",
"preferences",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtptransceiver.py#L81-L101 | train | Override the default codec preferences. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcrtptransceiver.py | RTCRtpTransceiver.stop | async def stop(self):
"""
Permanently stops the :class:`RTCRtpTransceiver`.
"""
await self.__receiver.stop()
await self.__sender.stop()
self.__stopped = True | python | async def stop(self):
"""
Permanently stops the :class:`RTCRtpTransceiver`.
"""
await self.__receiver.stop()
await self.__sender.stop()
self.__stopped = True | [
"async",
"def",
"stop",
"(",
"self",
")",
":",
"await",
"self",
".",
"__receiver",
".",
"stop",
"(",
")",
"await",
"self",
".",
"__sender",
".",
"stop",
"(",
")",
"self",
".",
"__stopped",
"=",
"True"
] | Permanently stops the :class:`RTCRtpTransceiver`. | [
"Permanently",
"stops",
"the",
":",
"class",
":",
"RTCRtpTransceiver",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtptransceiver.py#L103-L109 | train | Stops the RTCRtpTransceiver. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/contrib/media.py | MediaBlackhole.start | async def start(self):
"""
Start discarding media.
"""
for track, task in self.__tracks.items():
if task is None:
self.__tracks[track] = asyncio.ensure_future(blackhole_consume(track)) | python | async def start(self):
"""
Start discarding media.
"""
for track, task in self.__tracks.items():
if task is None:
self.__tracks[track] = asyncio.ensure_future(blackhole_consume(track)) | [
"async",
"def",
"start",
"(",
"self",
")",
":",
"for",
"track",
",",
"task",
"in",
"self",
".",
"__tracks",
".",
"items",
"(",
")",
":",
"if",
"task",
"is",
"None",
":",
"self",
".",
"__tracks",
"[",
"track",
"]",
"=",
"asyncio",
".",
"ensure_futur... | Start discarding media. | [
"Start",
"discarding",
"media",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/media.py#L62-L68 | train | Start discarding media. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/contrib/media.py | MediaBlackhole.stop | async def stop(self):
"""
Stop discarding media.
"""
for task in self.__tracks.values():
if task is not None:
task.cancel()
self.__tracks = {} | python | async def stop(self):
"""
Stop discarding media.
"""
for task in self.__tracks.values():
if task is not None:
task.cancel()
self.__tracks = {} | [
"async",
"def",
"stop",
"(",
"self",
")",
":",
"for",
"task",
"in",
"self",
".",
"__tracks",
".",
"values",
"(",
")",
":",
"if",
"task",
"is",
"not",
"None",
":",
"task",
".",
"cancel",
"(",
")",
"self",
".",
"__tracks",
"=",
"{",
"}"
] | Stop discarding media. | [
"Stop",
"discarding",
"media",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/media.py#L70-L77 | train | Stop discarding all tracks. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/contrib/media.py | MediaRecorder.addTrack | def addTrack(self, track):
"""
Add a track to be recorded.
:param: track: An :class:`aiortc.AudioStreamTrack` or :class:`aiortc.VideoStreamTrack`.
"""
if track.kind == 'audio':
if self.__container.format.name == 'wav':
codec_name = 'pcm_s16le'
... | python | def addTrack(self, track):
"""
Add a track to be recorded.
:param: track: An :class:`aiortc.AudioStreamTrack` or :class:`aiortc.VideoStreamTrack`.
"""
if track.kind == 'audio':
if self.__container.format.name == 'wav':
codec_name = 'pcm_s16le'
... | [
"def",
"addTrack",
"(",
"self",
",",
"track",
")",
":",
"if",
"track",
".",
"kind",
"==",
"'audio'",
":",
"if",
"self",
".",
"__container",
".",
"format",
".",
"name",
"==",
"'wav'",
":",
"codec_name",
"=",
"'pcm_s16le'",
"elif",
"self",
".",
"__contai... | Add a track to be recorded.
:param: track: An :class:`aiortc.AudioStreamTrack` or :class:`aiortc.VideoStreamTrack`. | [
"Add",
"a",
"track",
"to",
"be",
"recorded",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/media.py#L306-L327 | train | Adds a track to be recorded. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/contrib/media.py | MediaRecorder.start | async def start(self):
"""
Start recording.
"""
for track, context in self.__tracks.items():
if context.task is None:
context.task = asyncio.ensure_future(self.__run_track(track, context)) | python | async def start(self):
"""
Start recording.
"""
for track, context in self.__tracks.items():
if context.task is None:
context.task = asyncio.ensure_future(self.__run_track(track, context)) | [
"async",
"def",
"start",
"(",
"self",
")",
":",
"for",
"track",
",",
"context",
"in",
"self",
".",
"__tracks",
".",
"items",
"(",
")",
":",
"if",
"context",
".",
"task",
"is",
"None",
":",
"context",
".",
"task",
"=",
"asyncio",
".",
"ensure_future",... | Start recording. | [
"Start",
"recording",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/media.py#L329-L335 | train | Start recording. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/contrib/media.py | MediaRecorder.stop | async def stop(self):
"""
Stop recording.
"""
if self.__container:
for track, context in self.__tracks.items():
if context.task is not None:
context.task.cancel()
context.task = None
for packet in con... | python | async def stop(self):
"""
Stop recording.
"""
if self.__container:
for track, context in self.__tracks.items():
if context.task is not None:
context.task.cancel()
context.task = None
for packet in con... | [
"async",
"def",
"stop",
"(",
"self",
")",
":",
"if",
"self",
".",
"__container",
":",
"for",
"track",
",",
"context",
"in",
"self",
".",
"__tracks",
".",
"items",
"(",
")",
":",
"if",
"context",
".",
"task",
"is",
"not",
"None",
":",
"context",
"."... | Stop recording. | [
"Stop",
"recording",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/media.py#L337-L352 | train | Stop recording. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcdtlstransport.py | RTCCertificate.expires | def expires(self):
"""
The date and time after which the certificate will be considered invalid.
"""
not_after = self._cert.get_notAfter().decode('ascii')
return datetime.datetime.strptime(not_after, '%Y%m%d%H%M%SZ').replace(
tzinfo=datetime.timezone.utc) | python | def expires(self):
"""
The date and time after which the certificate will be considered invalid.
"""
not_after = self._cert.get_notAfter().decode('ascii')
return datetime.datetime.strptime(not_after, '%Y%m%d%H%M%SZ').replace(
tzinfo=datetime.timezone.utc) | [
"def",
"expires",
"(",
"self",
")",
":",
"not_after",
"=",
"self",
".",
"_cert",
".",
"get_notAfter",
"(",
")",
".",
"decode",
"(",
"'ascii'",
")",
"return",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"not_after",
",",
"'%Y%m%d%H%M%SZ'",
")",
"."... | The date and time after which the certificate will be considered invalid. | [
"The",
"date",
"and",
"time",
"after",
"which",
"the",
"certificate",
"will",
"be",
"considered",
"invalid",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcdtlstransport.py#L173-L179 | train | Returns a datetime. datetime object representing the date and time after which the certificate will be considered invalid. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcdtlstransport.py | RTCCertificate.generateCertificate | def generateCertificate(cls):
"""
Create and return an X.509 certificate and corresponding private key.
:rtype: RTCCertificate
"""
key = generate_key()
cert = generate_certificate(key)
return cls(key=key, cert=cert) | python | def generateCertificate(cls):
"""
Create and return an X.509 certificate and corresponding private key.
:rtype: RTCCertificate
"""
key = generate_key()
cert = generate_certificate(key)
return cls(key=key, cert=cert) | [
"def",
"generateCertificate",
"(",
"cls",
")",
":",
"key",
"=",
"generate_key",
"(",
")",
"cert",
"=",
"generate_certificate",
"(",
"key",
")",
"return",
"cls",
"(",
"key",
"=",
"key",
",",
"cert",
"=",
"cert",
")"
] | Create and return an X.509 certificate and corresponding private key.
:rtype: RTCCertificate | [
"Create",
"and",
"return",
"an",
"X",
".",
"509",
"certificate",
"and",
"corresponding",
"private",
"key",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcdtlstransport.py#L191-L199 | train | Create and return an X.509 certificate and corresponding private key. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcdtlstransport.py | RTCDtlsTransport.start | async def start(self, remoteParameters):
"""
Start DTLS transport negotiation with the parameters of the remote
DTLS transport.
:param: remoteParameters: An :class:`RTCDtlsParameters`.
"""
assert self._state == State.NEW
assert len(remoteParameters.fingerprints)
... | python | async def start(self, remoteParameters):
"""
Start DTLS transport negotiation with the parameters of the remote
DTLS transport.
:param: remoteParameters: An :class:`RTCDtlsParameters`.
"""
assert self._state == State.NEW
assert len(remoteParameters.fingerprints)
... | [
"async",
"def",
"start",
"(",
"self",
",",
"remoteParameters",
")",
":",
"assert",
"self",
".",
"_state",
"==",
"State",
".",
"NEW",
"assert",
"len",
"(",
"remoteParameters",
".",
"fingerprints",
")",
"if",
"self",
".",
"transport",
".",
"role",
"==",
"'... | Start DTLS transport negotiation with the parameters of the remote
DTLS transport.
:param: remoteParameters: An :class:`RTCDtlsParameters`. | [
"Start",
"DTLS",
"transport",
"negotiation",
"with",
"the",
"parameters",
"of",
"the",
"remote",
"DTLS",
"transport",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcdtlstransport.py#L378-L459 | train | Start DTLS negotiation with the parameters of the remote DTLS transport. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcdtlstransport.py | RTCDtlsTransport.stop | async def stop(self):
"""
Stop and close the DTLS transport.
"""
if self._task is not None:
self._task.cancel()
self._task = None
if self._state in [State.CONNECTING, State.CONNECTED]:
lib.SSL_shutdown(self.ssl)
try:
... | python | async def stop(self):
"""
Stop and close the DTLS transport.
"""
if self._task is not None:
self._task.cancel()
self._task = None
if self._state in [State.CONNECTING, State.CONNECTED]:
lib.SSL_shutdown(self.ssl)
try:
... | [
"async",
"def",
"stop",
"(",
"self",
")",
":",
"if",
"self",
".",
"_task",
"is",
"not",
"None",
":",
"self",
".",
"_task",
".",
"cancel",
"(",
")",
"self",
".",
"_task",
"=",
"None",
"if",
"self",
".",
"_state",
"in",
"[",
"State",
".",
"CONNECTI... | Stop and close the DTLS transport. | [
"Stop",
"and",
"close",
"the",
"DTLS",
"transport",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcdtlstransport.py#L461-L475 | train | Stop and close the DTLS transport. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcdtlstransport.py | RTCDtlsTransport._write_ssl | async def _write_ssl(self):
"""
Flush outgoing data which OpenSSL put in our BIO to the transport.
"""
pending = lib.BIO_ctrl_pending(self.write_bio)
if pending > 0:
result = lib.BIO_read(self.write_bio, self.write_cdata, len(self.write_cdata))
await self.... | python | async def _write_ssl(self):
"""
Flush outgoing data which OpenSSL put in our BIO to the transport.
"""
pending = lib.BIO_ctrl_pending(self.write_bio)
if pending > 0:
result = lib.BIO_read(self.write_bio, self.write_cdata, len(self.write_cdata))
await self.... | [
"async",
"def",
"_write_ssl",
"(",
"self",
")",
":",
"pending",
"=",
"lib",
".",
"BIO_ctrl_pending",
"(",
"self",
".",
"write_bio",
")",
"if",
"pending",
">",
"0",
":",
"result",
"=",
"lib",
".",
"BIO_read",
"(",
"self",
".",
"write_bio",
",",
"self",
... | Flush outgoing data which OpenSSL put in our BIO to the transport. | [
"Flush",
"outgoing",
"data",
"which",
"OpenSSL",
"put",
"in",
"our",
"BIO",
"to",
"the",
"transport",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcdtlstransport.py#L632-L641 | train | Write SSL data to the transport. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rate.py | AimdRateControl.set_estimate | def set_estimate(self, bitrate: int, now_ms: int):
"""
For testing purposes.
"""
self.current_bitrate = self._clamp_bitrate(bitrate, bitrate)
self.current_bitrate_initialized = True
self.last_change_ms = now_ms | python | def set_estimate(self, bitrate: int, now_ms: int):
"""
For testing purposes.
"""
self.current_bitrate = self._clamp_bitrate(bitrate, bitrate)
self.current_bitrate_initialized = True
self.last_change_ms = now_ms | [
"def",
"set_estimate",
"(",
"self",
",",
"bitrate",
":",
"int",
",",
"now_ms",
":",
"int",
")",
":",
"self",
".",
"current_bitrate",
"=",
"self",
".",
"_clamp_bitrate",
"(",
"bitrate",
",",
"bitrate",
")",
"self",
".",
"current_bitrate_initialized",
"=",
"... | For testing purposes. | [
"For",
"testing",
"purposes",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rate.py#L50-L56 | train | Set the bitrate for the current log entry. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/mediastreams.py | AudioStreamTrack.recv | async def recv(self):
"""
Receive the next :class:`~av.audio.frame.AudioFrame`.
The base implementation just reads silence, subclass
:class:`AudioStreamTrack` to provide a useful implementation.
"""
if self.readyState != 'live':
raise MediaStreamError
... | python | async def recv(self):
"""
Receive the next :class:`~av.audio.frame.AudioFrame`.
The base implementation just reads silence, subclass
:class:`AudioStreamTrack` to provide a useful implementation.
"""
if self.readyState != 'live':
raise MediaStreamError
... | [
"async",
"def",
"recv",
"(",
"self",
")",
":",
"if",
"self",
".",
"readyState",
"!=",
"'live'",
":",
"raise",
"MediaStreamError",
"sample_rate",
"=",
"8000",
"samples",
"=",
"int",
"(",
"AUDIO_PTIME",
"*",
"sample_rate",
")",
"if",
"hasattr",
"(",
"self",
... | Receive the next :class:`~av.audio.frame.AudioFrame`.
The base implementation just reads silence, subclass
:class:`AudioStreamTrack` to provide a useful implementation. | [
"Receive",
"the",
"next",
":",
"class",
":",
"~av",
".",
"audio",
".",
"frame",
".",
"AudioFrame",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/mediastreams.py#L63-L90 | train | Receive the next audio frame. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/mediastreams.py | VideoStreamTrack.recv | async def recv(self):
"""
Receive the next :class:`~av.video.frame.VideoFrame`.
The base implementation just reads a 640x480 green frame at 30fps,
subclass :class:`VideoStreamTrack` to provide a useful implementation.
"""
pts, time_base = await self.next_timestamp()
... | python | async def recv(self):
"""
Receive the next :class:`~av.video.frame.VideoFrame`.
The base implementation just reads a 640x480 green frame at 30fps,
subclass :class:`VideoStreamTrack` to provide a useful implementation.
"""
pts, time_base = await self.next_timestamp()
... | [
"async",
"def",
"recv",
"(",
"self",
")",
":",
"pts",
",",
"time_base",
"=",
"await",
"self",
".",
"next_timestamp",
"(",
")",
"frame",
"=",
"VideoFrame",
"(",
"width",
"=",
"640",
",",
"height",
"=",
"480",
")",
"for",
"p",
"in",
"frame",
".",
"pl... | Receive the next :class:`~av.video.frame.VideoFrame`.
The base implementation just reads a 640x480 green frame at 30fps,
subclass :class:`VideoStreamTrack` to provide a useful implementation. | [
"Receive",
"the",
"next",
":",
"class",
":",
"~av",
".",
"video",
".",
"frame",
".",
"VideoFrame",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/mediastreams.py#L112-L126 | train | Receive the next : class : ~av. video. frame. VideoFrame. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | InboundStream.prune_chunks | def prune_chunks(self, tsn):
"""
Prune chunks up to the given TSN.
"""
pos = -1
size = 0
for i, chunk in enumerate(self.reassembly):
if uint32_gte(tsn, chunk.tsn):
pos = i
size += len(chunk.user_data)
else:
... | python | def prune_chunks(self, tsn):
"""
Prune chunks up to the given TSN.
"""
pos = -1
size = 0
for i, chunk in enumerate(self.reassembly):
if uint32_gte(tsn, chunk.tsn):
pos = i
size += len(chunk.user_data)
else:
... | [
"def",
"prune_chunks",
"(",
"self",
",",
"tsn",
")",
":",
"pos",
"=",
"-",
"1",
"size",
"=",
"0",
"for",
"i",
",",
"chunk",
"in",
"enumerate",
"(",
"self",
".",
"reassembly",
")",
":",
"if",
"uint32_gte",
"(",
"tsn",
",",
"chunk",
".",
"tsn",
")"... | Prune chunks up to the given TSN. | [
"Prune",
"chunks",
"up",
"to",
"the",
"given",
"TSN",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L514-L528 | train | Prune chunks up to the given TSN. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport.start | async def start(self, remoteCaps, remotePort):
"""
Start the transport.
"""
if not self.__started:
self.__started = True
self.__state = 'connecting'
self._remote_port = remotePort
# configure logging
if logger.isEnabledFor(logg... | python | async def start(self, remoteCaps, remotePort):
"""
Start the transport.
"""
if not self.__started:
self.__started = True
self.__state = 'connecting'
self._remote_port = remotePort
# configure logging
if logger.isEnabledFor(logg... | [
"async",
"def",
"start",
"(",
"self",
",",
"remoteCaps",
",",
"remotePort",
")",
":",
"if",
"not",
"self",
".",
"__started",
":",
"self",
".",
"__started",
"=",
"True",
"self",
".",
"__state",
"=",
"'connecting'",
"self",
".",
"_remote_port",
"=",
"remot... | Start the transport. | [
"Start",
"the",
"transport",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L657-L680 | train | Start the connection. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport.stop | async def stop(self):
"""
Stop the transport.
"""
if self._association_state != self.State.CLOSED:
await self._abort()
self.__transport._unregister_data_receiver(self)
self._set_state(self.State.CLOSED) | python | async def stop(self):
"""
Stop the transport.
"""
if self._association_state != self.State.CLOSED:
await self._abort()
self.__transport._unregister_data_receiver(self)
self._set_state(self.State.CLOSED) | [
"async",
"def",
"stop",
"(",
"self",
")",
":",
"if",
"self",
".",
"_association_state",
"!=",
"self",
".",
"State",
".",
"CLOSED",
":",
"await",
"self",
".",
"_abort",
"(",
")",
"self",
".",
"__transport",
".",
"_unregister_data_receiver",
"(",
"self",
"... | Stop the transport. | [
"Stop",
"the",
"transport",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L682-L689 | train | Stop the transport. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._init | async def _init(self):
"""
Initialize the association.
"""
chunk = InitChunk()
chunk.initiate_tag = self._local_verification_tag
chunk.advertised_rwnd = self._advertised_rwnd
chunk.outbound_streams = self._outbound_streams_count
chunk.inbound_streams = sel... | python | async def _init(self):
"""
Initialize the association.
"""
chunk = InitChunk()
chunk.initiate_tag = self._local_verification_tag
chunk.advertised_rwnd = self._advertised_rwnd
chunk.outbound_streams = self._outbound_streams_count
chunk.inbound_streams = sel... | [
"async",
"def",
"_init",
"(",
"self",
")",
":",
"chunk",
"=",
"InitChunk",
"(",
")",
"chunk",
".",
"initiate_tag",
"=",
"self",
".",
"_local_verification_tag",
"chunk",
".",
"advertised_rwnd",
"=",
"self",
".",
"_advertised_rwnd",
"chunk",
".",
"outbound_strea... | Initialize the association. | [
"Initialize",
"the",
"association",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L701-L716 | train | Initialize the association. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._get_extensions | def _get_extensions(self, params):
"""
Gets what extensions are supported by the remote party.
"""
for k, v in params:
if k == SCTP_PRSCTP_SUPPORTED:
self._remote_partial_reliability = True
elif k == SCTP_SUPPORTED_CHUNK_EXT:
self._... | python | def _get_extensions(self, params):
"""
Gets what extensions are supported by the remote party.
"""
for k, v in params:
if k == SCTP_PRSCTP_SUPPORTED:
self._remote_partial_reliability = True
elif k == SCTP_SUPPORTED_CHUNK_EXT:
self._... | [
"def",
"_get_extensions",
"(",
"self",
",",
"params",
")",
":",
"for",
"k",
",",
"v",
"in",
"params",
":",
"if",
"k",
"==",
"SCTP_PRSCTP_SUPPORTED",
":",
"self",
".",
"_remote_partial_reliability",
"=",
"True",
"elif",
"k",
"==",
"SCTP_SUPPORTED_CHUNK_EXT",
... | Gets what extensions are supported by the remote party. | [
"Gets",
"what",
"extensions",
"are",
"supported",
"by",
"the",
"remote",
"party",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L724-L732 | train | Gets what extensions are supported by the remote party. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._set_extensions | def _set_extensions(self, params):
"""
Sets what extensions are supported by the local party.
"""
extensions = []
if self._local_partial_reliability:
params.append((SCTP_PRSCTP_SUPPORTED, b''))
extensions.append(ForwardTsnChunk.type)
extensions.ap... | python | def _set_extensions(self, params):
"""
Sets what extensions are supported by the local party.
"""
extensions = []
if self._local_partial_reliability:
params.append((SCTP_PRSCTP_SUPPORTED, b''))
extensions.append(ForwardTsnChunk.type)
extensions.ap... | [
"def",
"_set_extensions",
"(",
"self",
",",
"params",
")",
":",
"extensions",
"=",
"[",
"]",
"if",
"self",
".",
"_local_partial_reliability",
":",
"params",
".",
"append",
"(",
"(",
"SCTP_PRSCTP_SUPPORTED",
",",
"b''",
")",
")",
"extensions",
".",
"append",
... | Sets what extensions are supported by the local party. | [
"Sets",
"what",
"extensions",
"are",
"supported",
"by",
"the",
"local",
"party",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L734-L744 | train | Sets what extensions are supported by the local party. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._get_inbound_stream | def _get_inbound_stream(self, stream_id):
"""
Get or create the inbound stream with the specified ID.
"""
if stream_id not in self._inbound_streams:
self._inbound_streams[stream_id] = InboundStream()
return self._inbound_streams[stream_id] | python | def _get_inbound_stream(self, stream_id):
"""
Get or create the inbound stream with the specified ID.
"""
if stream_id not in self._inbound_streams:
self._inbound_streams[stream_id] = InboundStream()
return self._inbound_streams[stream_id] | [
"def",
"_get_inbound_stream",
"(",
"self",
",",
"stream_id",
")",
":",
"if",
"stream_id",
"not",
"in",
"self",
".",
"_inbound_streams",
":",
"self",
".",
"_inbound_streams",
"[",
"stream_id",
"]",
"=",
"InboundStream",
"(",
")",
"return",
"self",
".",
"_inbo... | Get or create the inbound stream with the specified ID. | [
"Get",
"or",
"create",
"the",
"inbound",
"stream",
"with",
"the",
"specified",
"ID",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L746-L752 | train | Get or create the inbound stream with the specified ID. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._handle_data | async def _handle_data(self, data):
"""
Handle data received from the network.
"""
try:
_, _, verification_tag, chunks = parse_packet(data)
except ValueError:
return
# is this an init?
init_chunk = len([x for x in chunks if isinstance(x, I... | python | async def _handle_data(self, data):
"""
Handle data received from the network.
"""
try:
_, _, verification_tag, chunks = parse_packet(data)
except ValueError:
return
# is this an init?
init_chunk = len([x for x in chunks if isinstance(x, I... | [
"async",
"def",
"_handle_data",
"(",
"self",
",",
"data",
")",
":",
"try",
":",
"_",
",",
"_",
",",
"verification_tag",
",",
"chunks",
"=",
"parse_packet",
"(",
"data",
")",
"except",
"ValueError",
":",
"return",
"# is this an init?",
"init_chunk",
"=",
"l... | Handle data received from the network. | [
"Handle",
"data",
"received",
"from",
"the",
"network",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L757-L786 | train | Handle data received from the network. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._maybe_abandon | def _maybe_abandon(self, chunk):
"""
Determine if a chunk needs to be marked as abandoned.
If it does, it marks the chunk and any other chunk belong to the same
message as abandoned.
"""
if chunk._abandoned:
return True
abandon = (
(chunk... | python | def _maybe_abandon(self, chunk):
"""
Determine if a chunk needs to be marked as abandoned.
If it does, it marks the chunk and any other chunk belong to the same
message as abandoned.
"""
if chunk._abandoned:
return True
abandon = (
(chunk... | [
"def",
"_maybe_abandon",
"(",
"self",
",",
"chunk",
")",
":",
"if",
"chunk",
".",
"_abandoned",
":",
"return",
"True",
"abandon",
"=",
"(",
"(",
"chunk",
".",
"_max_retransmits",
"is",
"not",
"None",
"and",
"chunk",
".",
"_sent_count",
">",
"chunk",
".",... | Determine if a chunk needs to be marked as abandoned.
If it does, it marks the chunk and any other chunk belong to the same
message as abandoned. | [
"Determine",
"if",
"a",
"chunk",
"needs",
"to",
"be",
"marked",
"as",
"abandoned",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L788-L819 | train | Returns True if the chunk needs to be abandoned. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._mark_received | def _mark_received(self, tsn):
"""
Mark an incoming data TSN as received.
"""
# it's a duplicate
if uint32_gte(self._last_received_tsn, tsn) or tsn in self._sack_misordered:
self._sack_duplicates.append(tsn)
return True
# consolidate misordered en... | python | def _mark_received(self, tsn):
"""
Mark an incoming data TSN as received.
"""
# it's a duplicate
if uint32_gte(self._last_received_tsn, tsn) or tsn in self._sack_misordered:
self._sack_duplicates.append(tsn)
return True
# consolidate misordered en... | [
"def",
"_mark_received",
"(",
"self",
",",
"tsn",
")",
":",
"# it's a duplicate",
"if",
"uint32_gte",
"(",
"self",
".",
"_last_received_tsn",
",",
"tsn",
")",
"or",
"tsn",
"in",
"self",
".",
"_sack_misordered",
":",
"self",
".",
"_sack_duplicates",
".",
"app... | Mark an incoming data TSN as received. | [
"Mark",
"an",
"incoming",
"data",
"TSN",
"as",
"received",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L821-L842 | train | Mark an incoming data TSN as received. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._receive | async def _receive(self, stream_id, pp_id, data):
"""
Receive data stream -> ULP.
"""
await self._data_channel_receive(stream_id, pp_id, data) | python | async def _receive(self, stream_id, pp_id, data):
"""
Receive data stream -> ULP.
"""
await self._data_channel_receive(stream_id, pp_id, data) | [
"async",
"def",
"_receive",
"(",
"self",
",",
"stream_id",
",",
"pp_id",
",",
"data",
")",
":",
"await",
"self",
".",
"_data_channel_receive",
"(",
"stream_id",
",",
"pp_id",
",",
"data",
")"
] | Receive data stream -> ULP. | [
"Receive",
"data",
"stream",
"-",
">",
"ULP",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L844-L848 | train | Receive data from a ULP stream. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._receive_chunk | async def _receive_chunk(self, chunk):
"""
Handle an incoming chunk.
"""
self.__log_debug('< %s', chunk)
# common
if isinstance(chunk, DataChunk):
await self._receive_data_chunk(chunk)
elif isinstance(chunk, SackChunk):
await self._receive... | python | async def _receive_chunk(self, chunk):
"""
Handle an incoming chunk.
"""
self.__log_debug('< %s', chunk)
# common
if isinstance(chunk, DataChunk):
await self._receive_data_chunk(chunk)
elif isinstance(chunk, SackChunk):
await self._receive... | [
"async",
"def",
"_receive_chunk",
"(",
"self",
",",
"chunk",
")",
":",
"self",
".",
"__log_debug",
"(",
"'< %s'",
",",
"chunk",
")",
"# common",
"if",
"isinstance",
"(",
"chunk",
",",
"DataChunk",
")",
":",
"await",
"self",
".",
"_receive_data_chunk",
"(",... | Handle an incoming chunk. | [
"Handle",
"an",
"incoming",
"chunk",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L850-L971 | train | Handle an incoming chunk. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._receive_data_chunk | async def _receive_data_chunk(self, chunk):
"""
Handle a DATA chunk.
"""
self._sack_needed = True
# mark as received
if self._mark_received(chunk.tsn):
return
# find stream
inbound_stream = self._get_inbound_stream(chunk.stream_id)
#... | python | async def _receive_data_chunk(self, chunk):
"""
Handle a DATA chunk.
"""
self._sack_needed = True
# mark as received
if self._mark_received(chunk.tsn):
return
# find stream
inbound_stream = self._get_inbound_stream(chunk.stream_id)
#... | [
"async",
"def",
"_receive_data_chunk",
"(",
"self",
",",
"chunk",
")",
":",
"self",
".",
"_sack_needed",
"=",
"True",
"# mark as received",
"if",
"self",
".",
"_mark_received",
"(",
"chunk",
".",
"tsn",
")",
":",
"return",
"# find stream",
"inbound_stream",
"=... | Handle a DATA chunk. | [
"Handle",
"a",
"DATA",
"chunk",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L973-L991 | train | Handle a DATA chunk. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._receive_forward_tsn_chunk | async def _receive_forward_tsn_chunk(self, chunk):
"""
Handle a FORWARD TSN chunk.
"""
self._sack_needed = True
# it's a duplicate
if uint32_gte(self._last_received_tsn, chunk.cumulative_tsn):
return
def is_obsolete(x):
return uint32_gt(x... | python | async def _receive_forward_tsn_chunk(self, chunk):
"""
Handle a FORWARD TSN chunk.
"""
self._sack_needed = True
# it's a duplicate
if uint32_gte(self._last_received_tsn, chunk.cumulative_tsn):
return
def is_obsolete(x):
return uint32_gt(x... | [
"async",
"def",
"_receive_forward_tsn_chunk",
"(",
"self",
",",
"chunk",
")",
":",
"self",
".",
"_sack_needed",
"=",
"True",
"# it's a duplicate",
"if",
"uint32_gte",
"(",
"self",
".",
"_last_received_tsn",
",",
"chunk",
".",
"cumulative_tsn",
")",
":",
"return"... | Handle a FORWARD TSN chunk. | [
"Handle",
"a",
"FORWARD",
"TSN",
"chunk",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L993-L1031 | train | Handle a FORWARD TSN chunk. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._receive_sack_chunk | async def _receive_sack_chunk(self, chunk):
"""
Handle a SACK chunk.
"""
if uint32_gt(self._last_sacked_tsn, chunk.cumulative_tsn):
return
received_time = time.time()
self._last_sacked_tsn = chunk.cumulative_tsn
cwnd_fully_utilized = (self._flight_siz... | python | async def _receive_sack_chunk(self, chunk):
"""
Handle a SACK chunk.
"""
if uint32_gt(self._last_sacked_tsn, chunk.cumulative_tsn):
return
received_time = time.time()
self._last_sacked_tsn = chunk.cumulative_tsn
cwnd_fully_utilized = (self._flight_siz... | [
"async",
"def",
"_receive_sack_chunk",
"(",
"self",
",",
"chunk",
")",
":",
"if",
"uint32_gt",
"(",
"self",
".",
"_last_sacked_tsn",
",",
"chunk",
".",
"cumulative_tsn",
")",
":",
"return",
"received_time",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
... | Handle a SACK chunk. | [
"Handle",
"a",
"SACK",
"chunk",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1033-L1124 | train | Handle a SACK chunk. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._receive_reconfig_param | async def _receive_reconfig_param(self, param):
"""
Handle a RE-CONFIG parameter.
"""
self.__log_debug('<< %s', param)
if isinstance(param, StreamResetOutgoingParam):
# mark closed inbound streams
for stream_id in param.streams:
self._inbo... | python | async def _receive_reconfig_param(self, param):
"""
Handle a RE-CONFIG parameter.
"""
self.__log_debug('<< %s', param)
if isinstance(param, StreamResetOutgoingParam):
# mark closed inbound streams
for stream_id in param.streams:
self._inbo... | [
"async",
"def",
"_receive_reconfig_param",
"(",
"self",
",",
"param",
")",
":",
"self",
".",
"__log_debug",
"(",
"'<< %s'",
",",
"param",
")",
"if",
"isinstance",
"(",
"param",
",",
"StreamResetOutgoingParam",
")",
":",
"# mark closed inbound streams",
"for",
"s... | Handle a RE-CONFIG parameter. | [
"Handle",
"a",
"RE",
"-",
"CONFIG",
"parameter",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1126-L1169 | train | Handle a RE - CONFIG parameter. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._send | async def _send(self, stream_id, pp_id, user_data,
expiry=None, max_retransmits=None, ordered=True):
"""
Send data ULP -> stream.
"""
if ordered:
stream_seq = self._outbound_stream_seq.get(stream_id, 0)
else:
stream_seq = 0
fra... | python | async def _send(self, stream_id, pp_id, user_data,
expiry=None, max_retransmits=None, ordered=True):
"""
Send data ULP -> stream.
"""
if ordered:
stream_seq = self._outbound_stream_seq.get(stream_id, 0)
else:
stream_seq = 0
fra... | [
"async",
"def",
"_send",
"(",
"self",
",",
"stream_id",
",",
"pp_id",
",",
"user_data",
",",
"expiry",
"=",
"None",
",",
"max_retransmits",
"=",
"None",
",",
"ordered",
"=",
"True",
")",
":",
"if",
"ordered",
":",
"stream_seq",
"=",
"self",
".",
"_outb... | Send data ULP -> stream. | [
"Send",
"data",
"ULP",
"-",
">",
"stream",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1171-L1218 | train | Send data ULP to the stream. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._send_chunk | async def _send_chunk(self, chunk):
"""
Transmit a chunk (no bundling for now).
"""
self.__log_debug('> %s', chunk)
await self.__transport._send_data(serialize_packet(
self._local_port,
self._remote_port,
self._remote_verification_tag,
... | python | async def _send_chunk(self, chunk):
"""
Transmit a chunk (no bundling for now).
"""
self.__log_debug('> %s', chunk)
await self.__transport._send_data(serialize_packet(
self._local_port,
self._remote_port,
self._remote_verification_tag,
... | [
"async",
"def",
"_send_chunk",
"(",
"self",
",",
"chunk",
")",
":",
"self",
".",
"__log_debug",
"(",
"'> %s'",
",",
"chunk",
")",
"await",
"self",
".",
"__transport",
".",
"_send_data",
"(",
"serialize_packet",
"(",
"self",
".",
"_local_port",
",",
"self",... | Transmit a chunk (no bundling for now). | [
"Transmit",
"a",
"chunk",
"(",
"no",
"bundling",
"for",
"now",
")",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1220-L1229 | train | Transmit a single chunk. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._send_sack | async def _send_sack(self):
"""
Build and send a selective acknowledgement (SACK) chunk.
"""
gaps = []
gap_next = None
for tsn in sorted(self._sack_misordered):
pos = (tsn - self._last_received_tsn) % SCTP_TSN_MODULO
if tsn == gap_next:
... | python | async def _send_sack(self):
"""
Build and send a selective acknowledgement (SACK) chunk.
"""
gaps = []
gap_next = None
for tsn in sorted(self._sack_misordered):
pos = (tsn - self._last_received_tsn) % SCTP_TSN_MODULO
if tsn == gap_next:
... | [
"async",
"def",
"_send_sack",
"(",
"self",
")",
":",
"gaps",
"=",
"[",
"]",
"gap_next",
"=",
"None",
"for",
"tsn",
"in",
"sorted",
"(",
"self",
".",
"_sack_misordered",
")",
":",
"pos",
"=",
"(",
"tsn",
"-",
"self",
".",
"_last_received_tsn",
")",
"%... | Build and send a selective acknowledgement (SACK) chunk. | [
"Build",
"and",
"send",
"a",
"selective",
"acknowledgement",
"(",
"SACK",
")",
"chunk",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1242-L1265 | train | Builds and sends a selective acknowledgement ( SACK chunk. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._set_state | def _set_state(self, state):
"""
Transition the SCTP association to a new state.
"""
if state != self._association_state:
self.__log_debug('- %s -> %s', self._association_state, state)
self._association_state = state
if state == self.State.ESTABLISHED:
... | python | def _set_state(self, state):
"""
Transition the SCTP association to a new state.
"""
if state != self._association_state:
self.__log_debug('- %s -> %s', self._association_state, state)
self._association_state = state
if state == self.State.ESTABLISHED:
... | [
"def",
"_set_state",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
"!=",
"self",
".",
"_association_state",
":",
"self",
".",
"__log_debug",
"(",
"'- %s -> %s'",
",",
"self",
".",
"_association_state",
",",
"state",
")",
"self",
".",
"_association_stat... | Transition the SCTP association to a new state. | [
"Transition",
"the",
"SCTP",
"association",
"to",
"a",
"new",
"state",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1267-L1293 | train | Transition the SCTP association to a new state. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._transmit | async def _transmit(self):
"""
Transmit outbound data.
"""
# send FORWARD TSN
if self._forward_tsn_chunk is not None:
await self._send_chunk(self._forward_tsn_chunk)
self._forward_tsn_chunk = None
# ensure T3 is running
if not self... | python | async def _transmit(self):
"""
Transmit outbound data.
"""
# send FORWARD TSN
if self._forward_tsn_chunk is not None:
await self._send_chunk(self._forward_tsn_chunk)
self._forward_tsn_chunk = None
# ensure T3 is running
if not self... | [
"async",
"def",
"_transmit",
"(",
"self",
")",
":",
"# send FORWARD TSN",
"if",
"self",
".",
"_forward_tsn_chunk",
"is",
"not",
"None",
":",
"await",
"self",
".",
"_send_chunk",
"(",
"self",
".",
"_forward_tsn_chunk",
")",
"self",
".",
"_forward_tsn_chunk",
"=... | Transmit outbound data. | [
"Transmit",
"outbound",
"data",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1383-L1434 | train | Transmit the current T3 message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._update_advanced_peer_ack_point | def _update_advanced_peer_ack_point(self):
"""
Try to advance "Advanced.Peer.Ack.Point" according to RFC 3758.
"""
if uint32_gt(self._last_sacked_tsn, self._advanced_peer_ack_tsn):
self._advanced_peer_ack_tsn = self._last_sacked_tsn
done = 0
streams = {}
... | python | def _update_advanced_peer_ack_point(self):
"""
Try to advance "Advanced.Peer.Ack.Point" according to RFC 3758.
"""
if uint32_gt(self._last_sacked_tsn, self._advanced_peer_ack_tsn):
self._advanced_peer_ack_tsn = self._last_sacked_tsn
done = 0
streams = {}
... | [
"def",
"_update_advanced_peer_ack_point",
"(",
"self",
")",
":",
"if",
"uint32_gt",
"(",
"self",
".",
"_last_sacked_tsn",
",",
"self",
".",
"_advanced_peer_ack_tsn",
")",
":",
"self",
".",
"_advanced_peer_ack_tsn",
"=",
"self",
".",
"_last_sacked_tsn",
"done",
"="... | Try to advance "Advanced.Peer.Ack.Point" according to RFC 3758. | [
"Try",
"to",
"advance",
"Advanced",
".",
"Peer",
".",
"Ack",
".",
"Point",
"according",
"to",
"RFC",
"3758",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1451-L1471 | train | Update the internal internal | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._update_rto | def _update_rto(self, R):
"""
Update RTO given a new roundtrip measurement R.
"""
if self._srtt is None:
self._rttvar = R / 2
self._srtt = R
else:
self._rttvar = (1 - SCTP_RTO_BETA) * self._rttvar + SCTP_RTO_BETA * abs(self._srtt - R)
... | python | def _update_rto(self, R):
"""
Update RTO given a new roundtrip measurement R.
"""
if self._srtt is None:
self._rttvar = R / 2
self._srtt = R
else:
self._rttvar = (1 - SCTP_RTO_BETA) * self._rttvar + SCTP_RTO_BETA * abs(self._srtt - R)
... | [
"def",
"_update_rto",
"(",
"self",
",",
"R",
")",
":",
"if",
"self",
".",
"_srtt",
"is",
"None",
":",
"self",
".",
"_rttvar",
"=",
"R",
"/",
"2",
"self",
".",
"_srtt",
"=",
"R",
"else",
":",
"self",
".",
"_rttvar",
"=",
"(",
"1",
"-",
"SCTP_RTO... | Update RTO given a new roundtrip measurement R. | [
"Update",
"RTO",
"given",
"a",
"new",
"roundtrip",
"measurement",
"R",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1473-L1483 | train | Update the RTO variable based on the new roundtrip measurement R. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._data_channel_close | def _data_channel_close(self, channel, transmit=True):
"""
Request closing the datachannel by sending an Outgoing Stream Reset Request.
"""
if channel.readyState not in ['closing', 'closed']:
channel._setReadyState('closing')
self._reconfig_queue.append(channel.id... | python | def _data_channel_close(self, channel, transmit=True):
"""
Request closing the datachannel by sending an Outgoing Stream Reset Request.
"""
if channel.readyState not in ['closing', 'closed']:
channel._setReadyState('closing')
self._reconfig_queue.append(channel.id... | [
"def",
"_data_channel_close",
"(",
"self",
",",
"channel",
",",
"transmit",
"=",
"True",
")",
":",
"if",
"channel",
".",
"readyState",
"not",
"in",
"[",
"'closing'",
",",
"'closed'",
"]",
":",
"channel",
".",
"_setReadyState",
"(",
"'closing'",
")",
"self"... | Request closing the datachannel by sending an Outgoing Stream Reset Request. | [
"Request",
"closing",
"the",
"datachannel",
"by",
"sending",
"an",
"Outgoing",
"Stream",
"Reset",
"Request",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1485-L1493 | train | Closes the data channel. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcsctptransport.py | RTCSctpTransport._data_channel_flush | async def _data_channel_flush(self):
"""
Try to flush buffered data to the SCTP layer.
We wait until the association is established, as we need to know
whether we are a client or a server to correctly assign an odd/even ID
to the data channels.
"""
if self._assoc... | python | async def _data_channel_flush(self):
"""
Try to flush buffered data to the SCTP layer.
We wait until the association is established, as we need to know
whether we are a client or a server to correctly assign an odd/even ID
to the data channels.
"""
if self._assoc... | [
"async",
"def",
"_data_channel_flush",
"(",
"self",
")",
":",
"if",
"self",
".",
"_association_state",
"!=",
"self",
".",
"State",
".",
"ESTABLISHED",
":",
"return",
"while",
"self",
".",
"_data_channel_queue",
"and",
"not",
"self",
".",
"_outbound_queue",
":"... | Try to flush buffered data to the SCTP layer.
We wait until the association is established, as we need to know
whether we are a client or a server to correctly assign an odd/even ID
to the data channels. | [
"Try",
"to",
"flush",
"buffered",
"data",
"to",
"the",
"SCTP",
"layer",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1499-L1535 | train | Flush buffered data to the SCTP layer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/contrib/signaling.py | add_signaling_arguments | def add_signaling_arguments(parser):
"""
Add signaling method arguments to an argparse.ArgumentParser.
"""
parser.add_argument('--signaling', '-s', choices=[
'copy-and-paste', 'tcp-socket', 'unix-socket'])
parser.add_argument('--signaling-host', default='127.0.0.1',
h... | python | def add_signaling_arguments(parser):
"""
Add signaling method arguments to an argparse.ArgumentParser.
"""
parser.add_argument('--signaling', '-s', choices=[
'copy-and-paste', 'tcp-socket', 'unix-socket'])
parser.add_argument('--signaling-host', default='127.0.0.1',
h... | [
"def",
"add_signaling_arguments",
"(",
"parser",
")",
":",
"parser",
".",
"add_argument",
"(",
"'--signaling'",
",",
"'-s'",
",",
"choices",
"=",
"[",
"'copy-and-paste'",
",",
"'tcp-socket'",
",",
"'unix-socket'",
"]",
")",
"parser",
".",
"add_argument",
"(",
... | Add signaling method arguments to an argparse.ArgumentParser. | [
"Add",
"signaling",
"method",
"arguments",
"to",
"an",
"argparse",
".",
"ArgumentParser",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/signaling.py#L180-L191 | train | Adds signaling method arguments to an argparse. ArgumentParser. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/contrib/signaling.py | create_signaling | def create_signaling(args):
"""
Create a signaling method based on command-line arguments.
"""
if args.signaling == 'tcp-socket':
return TcpSocketSignaling(args.signaling_host, args.signaling_port)
elif args.signaling == 'unix-socket':
return UnixSocketSignaling(args.signaling_path)
... | python | def create_signaling(args):
"""
Create a signaling method based on command-line arguments.
"""
if args.signaling == 'tcp-socket':
return TcpSocketSignaling(args.signaling_host, args.signaling_port)
elif args.signaling == 'unix-socket':
return UnixSocketSignaling(args.signaling_path)
... | [
"def",
"create_signaling",
"(",
"args",
")",
":",
"if",
"args",
".",
"signaling",
"==",
"'tcp-socket'",
":",
"return",
"TcpSocketSignaling",
"(",
"args",
".",
"signaling_host",
",",
"args",
".",
"signaling_port",
")",
"elif",
"args",
".",
"signaling",
"==",
... | Create a signaling method based on command-line arguments. | [
"Create",
"a",
"signaling",
"method",
"based",
"on",
"command",
"-",
"line",
"arguments",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/signaling.py#L194-L203 | train | Create a signaling method based on command - line arguments. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcrtpreceiver.py | RemoteStreamTrack.recv | async def recv(self):
"""
Receive the next frame.
"""
if self.readyState != 'live':
raise MediaStreamError
frame = await self._queue.get()
if frame is None:
self.stop()
raise MediaStreamError
return frame | python | async def recv(self):
"""
Receive the next frame.
"""
if self.readyState != 'live':
raise MediaStreamError
frame = await self._queue.get()
if frame is None:
self.stop()
raise MediaStreamError
return frame | [
"async",
"def",
"recv",
"(",
"self",
")",
":",
"if",
"self",
".",
"readyState",
"!=",
"'live'",
":",
"raise",
"MediaStreamError",
"frame",
"=",
"await",
"self",
".",
"_queue",
".",
"get",
"(",
")",
"if",
"frame",
"is",
"None",
":",
"self",
".",
"stop... | Receive the next frame. | [
"Receive",
"the",
"next",
"frame",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L149-L160 | train | Receive the next frame from the queue. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcrtpreceiver.py | RTCRtpReceiver.getStats | async def getStats(self):
"""
Returns statistics about the RTP receiver.
:rtype: :class:`RTCStatsReport`
"""
for ssrc, stream in self.__remote_streams.items():
self.__stats.add(RTCInboundRtpStreamStats(
# RTCStats
timestamp=clock.curre... | python | async def getStats(self):
"""
Returns statistics about the RTP receiver.
:rtype: :class:`RTCStatsReport`
"""
for ssrc, stream in self.__remote_streams.items():
self.__stats.add(RTCInboundRtpStreamStats(
# RTCStats
timestamp=clock.curre... | [
"async",
"def",
"getStats",
"(",
"self",
")",
":",
"for",
"ssrc",
",",
"stream",
"in",
"self",
".",
"__remote_streams",
".",
"items",
"(",
")",
":",
"self",
".",
"__stats",
".",
"add",
"(",
"RTCInboundRtpStreamStats",
"(",
"# RTCStats",
"timestamp",
"=",
... | Returns statistics about the RTP receiver.
:rtype: :class:`RTCStatsReport` | [
"Returns",
"statistics",
"about",
"the",
"RTP",
"receiver",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L262-L286 | train | Returns statistics about the receiver. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcrtpreceiver.py | RTCRtpReceiver.getSynchronizationSources | def getSynchronizationSources(self):
"""
Returns a :class:`RTCRtpSynchronizationSource` for each unique SSRC identifier
received in the last 10 seconds.
"""
cutoff = clock.current_datetime() - datetime.timedelta(seconds=10)
sources = []
for source, timestamp in se... | python | def getSynchronizationSources(self):
"""
Returns a :class:`RTCRtpSynchronizationSource` for each unique SSRC identifier
received in the last 10 seconds.
"""
cutoff = clock.current_datetime() - datetime.timedelta(seconds=10)
sources = []
for source, timestamp in se... | [
"def",
"getSynchronizationSources",
"(",
"self",
")",
":",
"cutoff",
"=",
"clock",
".",
"current_datetime",
"(",
")",
"-",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"10",
")",
"sources",
"=",
"[",
"]",
"for",
"source",
",",
"timestamp",
"in",
"s... | Returns a :class:`RTCRtpSynchronizationSource` for each unique SSRC identifier
received in the last 10 seconds. | [
"Returns",
"a",
":",
"class",
":",
"RTCRtpSynchronizationSource",
"for",
"each",
"unique",
"SSRC",
"identifier",
"received",
"in",
"the",
"last",
"10",
"seconds",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L288-L298 | train | Returns a list of RTCRtpSynchronizationSource objects for each unique SSRC identifier in the last 10 seconds. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcrtpreceiver.py | RTCRtpReceiver.receive | async def receive(self, parameters: RTCRtpReceiveParameters):
"""
Attempt to set the parameters controlling the receiving of media.
:param: parameters: The :class:`RTCRtpParameters` for the receiver.
"""
if not self.__started:
for codec in parameters.codecs:
... | python | async def receive(self, parameters: RTCRtpReceiveParameters):
"""
Attempt to set the parameters controlling the receiving of media.
:param: parameters: The :class:`RTCRtpParameters` for the receiver.
"""
if not self.__started:
for codec in parameters.codecs:
... | [
"async",
"def",
"receive",
"(",
"self",
",",
"parameters",
":",
"RTCRtpReceiveParameters",
")",
":",
"if",
"not",
"self",
".",
"__started",
":",
"for",
"codec",
"in",
"parameters",
".",
"codecs",
":",
"self",
".",
"__codecs",
"[",
"codec",
".",
"payloadTyp... | Attempt to set the parameters controlling the receiving of media.
:param: parameters: The :class:`RTCRtpParameters` for the receiver. | [
"Attempt",
"to",
"set",
"the",
"parameters",
"controlling",
"the",
"receiving",
"of",
"media",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L300-L322 | train | This method is called by the RTCP receiver when the media is received. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aiortc/aiortc | aiortc/rtcrtpreceiver.py | RTCRtpReceiver.stop | async def stop(self):
"""
Irreversibly stop the receiver.
"""
if self.__started:
self.__transport._unregister_rtp_receiver(self)
self.__stop_decoder()
self.__rtcp_task.cancel()
await self.__rtcp_exited.wait() | python | async def stop(self):
"""
Irreversibly stop the receiver.
"""
if self.__started:
self.__transport._unregister_rtp_receiver(self)
self.__stop_decoder()
self.__rtcp_task.cancel()
await self.__rtcp_exited.wait() | [
"async",
"def",
"stop",
"(",
"self",
")",
":",
"if",
"self",
".",
"__started",
":",
"self",
".",
"__transport",
".",
"_unregister_rtp_receiver",
"(",
"self",
")",
"self",
".",
"__stop_decoder",
"(",
")",
"self",
".",
"__rtcp_task",
".",
"cancel",
"(",
")... | Irreversibly stop the receiver. | [
"Irreversibly",
"stop",
"the",
"receiver",
"."
] | 60ed036abf4575bd63985724b4493d569e6da29b | https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L327-L335 | train | Stop the receiver. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.