1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // The <code>chrome.cast.streaming.rtpStream</code> API allows configuration
6 // of encoding parameters and RTP parameters used in a Cast streaming
9 // Valid stream IDs are positive and non-zero.
10 namespace cast.streaming.rtpStream
{
11 // Params for audio and video codec.
12 dictionary CodecSpecificParams
{
18 dictionary RtpPayloadParams
{
21 // Maximum latency in milliseconds. This parameter controls the logic
22 // of flow control. Implementation can adjust latency adaptively and
23 // tries to keep it under this threshold. A larger value allows smoother
24 // playback at the cost of higher latency.
27 // Minimum latency in milliseconds. Defaults to |maxLatency|.
32 // Synchronization source identifier.
39 // Minimum bitrate in kilobits per second.
42 // Maximum bitrate in kilobits per second.
45 // The number of channels.
48 // The maximum frame rate.
51 // Video width in pixels.
54 // Video height in pixels.
57 // 32 bytes hex-encoded AES key.
60 // 32 bytes hex-encoded AES IV (Initialization vector) mask.
63 // A list of codec specific params.
64 CodecSpecificParams
[] codecSpecificParams
;
67 // Cast RTP parameters.
68 dictionary RtpParams
{
69 // RTP payload params.
70 RtpPayloadParams payload
;
72 DOMString
[] rtcpFeatures
;
75 // Callback from the <code>create</code> method.
76 // |id| : The ID for the RTP stream.
77 callback CreateCallback
= void (long streamId
);
79 // Callback from the <code>getRawEvents</code> method.
80 // |rawEvents|: compressed serialized raw bytes containing raw events
81 // recorded for a stream.
82 // The compression is in gzip format.
83 // The serialization format can be found at
84 // media/cast/logging/log_serializer.cc.
85 callback GetRawEventsCallback
= void (ArrayBuffer rawEvents
);
87 // Callback from the <code>getStats</code> method.
88 // |rawEvents|: dictionary object containing stats recorded for a stream.
89 // The format can be found at
90 // media/cast/logging/stats_event_subscriber.cc.
91 callback GetStatsCallback
= void (object stats
);
94 // Destroys a Cast RTP stream.
95 // |streamId| : The RTP stream ID.
96 [nocompile
] static
void destroy
(long streamId
);
98 // Returns an array of supported parameters with default values.
99 // This includes a list of supported codecs on this platform and
100 // corresponding encoding and RTP parameters.
101 // |streamId| : The RTP stream ID.
102 [nocompile
] static RtpParams
[] getSupportedParams
(long streamId
);
104 // Activates the RTP stream by providing the parameters.
105 // |streamId| : The RTP stream ID.
106 // |params| : Parameters set for this stream.
107 [nocompile
] static
void start
(long streamId
, RtpParams params
);
109 // Stops activity on the specified stream.
110 // |streamId| : The RTP stream ID.
111 [nocompile
] static
void stop
(long streamId
);
113 // Enables / disables logging for a stream.
114 // |enable|: If true, enables logging. Otherwise disables logging.
115 [nocompile
] static
void toggleLogging
(long streamId
, boolean enable
);
117 // Get raw events for a stream in the current session.
118 // |streamId|: Stream to get events for.
119 // |extraData|: Extra data to attach to the log, e.g. system info or
120 // experiment tags, in key-value JSON string format.
121 // |callback|: Called with the raw events.
122 [nocompile
] static
void getRawEvents
(
123 long streamId
, optional DOMString extraData
,
124 GetRawEventsCallback
callback);
126 // Get stats for a stream in the current session.
127 // |streamId|: Stream to get stats for.
128 // |callback|: Called with the stats.
129 [nocompile
] static
void getStats
(
130 long streamId
, GetStatsCallback
callback);
134 // Event fired when a Cast RTP stream has started.
135 // |streamId| : The ID of the RTP stream.
136 static
void onStarted
(long streamId
);
138 // Event fired when a Cast RTP stream has stopped.
139 // |streamId| : The ID of the RTP stream.
140 static
void onStopped
(long streamId
);
142 // Event fired when a Cast RTP stream has error.
143 // |streamId| : The ID of the RTP stream.
144 // |errorString| : The error info.
145 static
void onError
(long streamId
, DOMString errorString
);