feat(daily): add camera_out_send_settings and deprecate video_out_bitrate
Replaces the hardcoded camera publishing send settings in DailyTransport with a new DailyParams.camera_out_send_settings dict that applications can pass through verbatim to the Daily client. This makes the encoding/codec/bitrate configuration user-controllable instead of being driven solely by the generic TransportParams fields. As a consequence, TransportParams.video_out_bitrate is deprecated for the Daily transport (now configured via camera_out_send_settings) and its default is changed to None.
This commit is contained in:
@@ -90,6 +90,18 @@ class BaseOutputTransport(FrameProcessor):
|
|||||||
# it.
|
# it.
|
||||||
self._media_senders: dict[Any, BaseOutputTransport.MediaSender] = {}
|
self._media_senders: dict[Any, BaseOutputTransport.MediaSender] = {}
|
||||||
|
|
||||||
|
if params.video_out_bitrate is not None:
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("always")
|
||||||
|
warnings.warn(
|
||||||
|
"Transport parameter `video_out_bitrate` is deprecated and will be removed in a future "
|
||||||
|
"version. Use provider specific settings instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sample_rate(self) -> int:
|
def sample_rate(self) -> int:
|
||||||
"""Get the current audio sample rate.
|
"""Get the current audio sample rate.
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class TransportParams(BaseModel):
|
|||||||
video_out_is_live: Enable real-time video output streaming.
|
video_out_is_live: Enable real-time video output streaming.
|
||||||
video_out_width: Video output width in pixels.
|
video_out_width: Video output width in pixels.
|
||||||
video_out_height: Video output height in pixels.
|
video_out_height: Video output height in pixels.
|
||||||
video_out_bitrate: Video output bitrate in bits per second.
|
video_out_bitrate: [DEPRECATED] Video output bitrate in bits per second.
|
||||||
video_out_framerate: Video output frame rate in FPS.
|
video_out_framerate: Video output frame rate in FPS.
|
||||||
video_out_color_format: Video output color format string.
|
video_out_color_format: Video output color format string.
|
||||||
video_out_codec: Preferred video codec for output (e.g., 'VP8', 'H264', 'H265').
|
video_out_codec: Preferred video codec for output (e.g., 'VP8', 'H264', 'H265').
|
||||||
@@ -76,7 +76,7 @@ class TransportParams(BaseModel):
|
|||||||
video_out_is_live: bool = False
|
video_out_is_live: bool = False
|
||||||
video_out_width: int = 1024
|
video_out_width: int = 1024
|
||||||
video_out_height: int = 768
|
video_out_height: int = 768
|
||||||
video_out_bitrate: int = 800000
|
video_out_bitrate: int | None = None
|
||||||
video_out_framerate: int = 30
|
video_out_framerate: int = 30
|
||||||
video_out_color_format: str = "RGB"
|
video_out_color_format: str = "RGB"
|
||||||
video_out_codec: str | None = None
|
video_out_codec: str | None = None
|
||||||
|
|||||||
@@ -325,6 +325,7 @@ class DailyParams(TransportParams):
|
|||||||
api_key: Daily API authentication key.
|
api_key: Daily API authentication key.
|
||||||
audio_in_user_tracks: Receive users' audio in separate tracks
|
audio_in_user_tracks: Receive users' audio in separate tracks
|
||||||
camera_out_enabled: Whether to enable the main camera output track.
|
camera_out_enabled: Whether to enable the main camera output track.
|
||||||
|
camera_out_send_settings: Camera output track publishing settings.
|
||||||
custom_audio_track_params: Per-destination configuration for custom audio tracks.
|
custom_audio_track_params: Per-destination configuration for custom audio tracks.
|
||||||
custom_video_track_params: Per-destination configuration for custom video tracks.
|
custom_video_track_params: Per-destination configuration for custom video tracks.
|
||||||
dialin_settings: Optional settings for dial-in functionality.
|
dialin_settings: Optional settings for dial-in functionality.
|
||||||
@@ -337,6 +338,7 @@ class DailyParams(TransportParams):
|
|||||||
api_key: str = ""
|
api_key: str = ""
|
||||||
audio_in_user_tracks: bool = True
|
audio_in_user_tracks: bool = True
|
||||||
camera_out_enabled: bool = True
|
camera_out_enabled: bool = True
|
||||||
|
camera_out_send_settings: dict[str, Any] | None = None
|
||||||
custom_audio_track_params: Mapping[str, DailyCustomAudioTrackParams] | None = None
|
custom_audio_track_params: Mapping[str, DailyCustomAudioTrackParams] | None = None
|
||||||
custom_video_track_params: Mapping[str, DailyCustomVideoTrackParams] | None = None
|
custom_video_track_params: Mapping[str, DailyCustomVideoTrackParams] | None = None
|
||||||
dialin_settings: DailyDialinSettings | None = None
|
dialin_settings: DailyDialinSettings | None = None
|
||||||
@@ -909,20 +911,9 @@ class DailyTransportClient(EventHandler):
|
|||||||
"publishing": {
|
"publishing": {
|
||||||
"camera": {
|
"camera": {
|
||||||
"isPublishing": camera_enabled,
|
"isPublishing": camera_enabled,
|
||||||
"sendSettings": {
|
"sendSettings": self._params.camera_out_send_settings
|
||||||
"maxQuality": "low",
|
if self._params.camera_out_send_settings
|
||||||
**(
|
else {},
|
||||||
{"preferredCodec": self._params.video_out_codec}
|
|
||||||
if self._params.video_out_codec
|
|
||||||
else {}
|
|
||||||
),
|
|
||||||
"encodings": {
|
|
||||||
"low": {
|
|
||||||
"maxBitrate": self._params.video_out_bitrate,
|
|
||||||
"maxFramerate": self._params.video_out_framerate,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
"microphone": {
|
"microphone": {
|
||||||
"isPublishing": microphone_enabled,
|
"isPublishing": microphone_enabled,
|
||||||
|
|||||||
Reference in New Issue
Block a user