Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions examples/local_video/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ def _open_camera(args: argparse.Namespace) -> tuple[cv2.VideoCapture, int, int]:
return capture, width, height


def _packet_trailer_features(args: argparse.Namespace) -> list[int]:
def _frame_metadata_features(args: argparse.Namespace) -> list[int]:
features = []
if args.attach_timestamp:
features.append(rtc.PacketTrailerFeature.PTF_USER_TIMESTAMP)
features.append(rtc.FrameMetadataFeature.FMF_USER_TIMESTAMP)
if args.attach_frame_id:
features.append(rtc.PacketTrailerFeature.PTF_FRAME_ID)
features.append(rtc.FrameMetadataFeature.FMF_FRAME_ID)
return features


Expand Down Expand Up @@ -224,13 +224,13 @@ async def run(args: argparse.Namespace, stop_event: asyncio.Event) -> None:
max_framerate=args.fps,
max_bitrate=3_000_000,
),
packet_trailer_features=_packet_trailer_features(args),
frame_metadata_features=_frame_metadata_features(args),
)
publication = await room.local_participant.publish_track(track, options)
logging.info(
"published camera track %s with packet trailer features %s",
"published camera track %s with frame metadata features %s",
publication.sid,
list(publication.packet_trailer_features),
list(publication.frame_metadata_features),
)

await _capture_loop(args, capture, source, width, height, stop_event)
Expand Down
6 changes: 3 additions & 3 deletions examples/local_video/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _feature_names(features: list[int]) -> str:
names = []
for feature in features:
try:
names.append(rtc.PacketTrailerFeature.Name(feature))
names.append(rtc.FrameMetadataFeature.Name(feature))
except ValueError:
names.append(str(feature))
return ", ".join(names) or "none"
Expand Down Expand Up @@ -309,10 +309,10 @@ def on_track_unpublished(
active_publication_sid = subscribed.publication.sid
active_track_gone = asyncio.Event()
logging.info(
"subscribed to %s from %s with packet trailer features: %s",
"subscribed to %s from %s with frame metadata features: %s",
subscribed.publication.sid,
subscribed.participant.identity,
_feature_names(list(subscribed.publication.packet_trailer_features)),
_feature_names(list(subscribed.publication.frame_metadata_features)),
)

video_stream = rtc.VideoStream.from_track(
Expand Down
38 changes: 37 additions & 1 deletion livekit-rtc/livekit/rtc/__init__.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚩 livekit-protocol package still uses old PacketTrailerFeature names

The livekit-protocol package (livekit-protocol/livekit/protocol/models.py, models.pyi, rtc.pyi) still defines and references PacketTrailerFeature, PTF_USER_TIMESTAMP, PTF_FRAME_ID, and packet_trailer_features. This is a separate package from livekit-rtc and appears to represent the server-side protocol definitions. If these two packages are used together in applications, the naming inconsistency could be confusing. This may just mean the protocol package hasn't been updated yet and will follow in a separate PR.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
See https://docs.livekit.io/home/client/connect/#installing-the-livekit-sdk for more information.
"""

import warnings

from ._proto import stats_pb2 as stats
from ._proto.e2ee_pb2 import EncryptionState, EncryptionType, KeyDerivationFunction
from ._proto.participant_pb2 import (
Expand All @@ -37,7 +39,7 @@
VideoEncoding,
)
from ._proto.track_pb2 import (
PacketTrailerFeature,
FrameMetadataFeature,
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
StreamState,
TrackKind,
TrackSource,
Expand Down Expand Up @@ -134,6 +136,39 @@
)
from .frame_processor import FrameProcessor

class _PacketTrailerFeature:
"""Deprecated alias for :class:`FrameMetadataFeature`.

"Packet Trailer" was renamed to "Frame Metadata" upstream. This shim keeps
the old ``PacketTrailerFeature`` name working, including the old ``PTF_*``
value names (which now map to their ``FMF_*`` equivalents), and forwards
everything else to :class:`FrameMetadataFeature`. Prefer
``FrameMetadataFeature`` / the ``FMF_*`` values; this will be removed in a
future release.
"""

_RENAMED = {
"PTF_USER_TIMESTAMP": "FMF_USER_TIMESTAMP",
"PTF_FRAME_ID": "FMF_FRAME_ID",
}

def __getattr__(self, name: str):
renamed = self._RENAMED.get(name)
if renamed is not None:
warnings.warn(
f"PacketTrailerFeature.{name} is deprecated, "
f"use FrameMetadataFeature.{renamed} instead",
DeprecationWarning,
stacklevel=2,
)
name = renamed
return getattr(FrameMetadataFeature, name)


# Deprecated: "Packet Trailer" was renamed to "Frame Metadata" upstream.
# Prefer FrameMetadataFeature; this alias will be removed in a future release.
PacketTrailerFeature = _PacketTrailerFeature()

__all__ = [
"ConnectionQuality",
"ConnectionState",
Expand All @@ -148,6 +183,7 @@
"StreamState",
"TrackKind",
"TrackSource",
"FrameMetadataFeature",
"PacketTrailerFeature",
"ParticipantTrackPermission",
"VideoBufferType",
Expand Down
28 changes: 14 additions & 14 deletions livekit-rtc/livekit/rtc/_proto/room_pb2.py

Large diffs are not rendered by default.

18 changes: 14 additions & 4 deletions livekit-rtc/livekit/rtc/_proto/room_pb2.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions livekit-rtc/livekit/rtc/_proto/track_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading