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 // 32 bytes hex-encoded AES key.
54 // 32 bytes hex-encoded AES IV (Initialization vector) mask.
57 // A list of codec specific params.
58 CodecSpecificParams
[] codecSpecificParams
;
61 // Cast RTP parameters.
62 dictionary RtpParams
{
63 // RTP payload params.
64 RtpPayloadParams payload
;
66 DOMString
[] rtcpFeatures
;
69 // Callback from the <code>create</code> method.
70 // |id| : The ID for the RTP stream.
71 callback CreateCallback
= void (long streamId
);
73 // Callback from the <code>getRawEvents</code> method.
74 // |rawEvents|: compressed serialized raw bytes containing raw events
75 // recorded for a stream.
76 // The compression is in gzip format.
77 // The serialization format can be found at
78 // media/cast/logging/log_serializer.cc.
79 callback GetRawEventsCallback
= void (ArrayBuffer rawEvents
);
81 // Callback from the <code>getStats</code> method.
82 // |rawEvents|: dictionary object containing stats recorded for a stream.
83 // The format can be found at
84 // media/cast/logging/stats_event_subscriber.cc.
85 callback GetStatsCallback
= void (object stats
);
88 // Destroys a Cast RTP stream.
89 // |streamId| : The RTP stream ID.
90 [nocompile
] static
void destroy
(long streamId
);
92 // Returns an array of supported parameters with default values.
93 // This includes a list of supported codecs on this platform and
94 // corresponding encoding and RTP parameters.
95 // |streamId| : The RTP stream ID.
96 [nocompile
] static RtpParams
[] getSupportedParams
(long streamId
);
98 // Activates the RTP stream by providing the parameters.
99 // |streamId| : The RTP stream ID.
100 // |params| : Parameters set for this stream.
101 [nocompile
] static
void start
(long streamId
, RtpParams params
);
103 // Stops activity on the specified stream.
104 // |streamId| : The RTP stream ID.
105 [nocompile
] static
void stop
(long streamId
);
107 // Enables / disables logging for a stream.
108 // |enable|: If true, enables logging. Otherwise disables logging.
109 [nocompile
] static
void toggleLogging
(long streamId
, boolean enable
);
111 // Get raw events for a stream in the current session.
112 // |streamId|: Stream to get events for.
113 // |extraData|: Extra data to attach to the log, e.g. system info or
114 // experiment tags, in key-value JSON string format.
115 // |callback|: Called with the raw events.
116 [nocompile
] static
void getRawEvents
(
117 long streamId
, optional DOMString extraData
,
118 GetRawEventsCallback
callback);
120 // Get stats for a stream in the current session.
121 // |streamId|: Stream to get stats for.
122 // |callback|: Called with the stats.
123 [nocompile
] static
void getStats
(
124 long streamId
, GetStatsCallback
callback);
128 // Event fired when a Cast RTP stream has started.
129 // |streamId| : The ID of the RTP stream.
130 static
void onStarted
(long streamId
);
132 // Event fired when a Cast RTP stream has stopped.
133 // |streamId| : The ID of the RTP stream.
134 static
void onStopped
(long streamId
);
136 // Event fired when a Cast RTP stream has error.
137 // |streamId| : The ID of the RTP stream.
138 // |errorString| : The error info.
139 static
void onError
(long streamId
, DOMString errorString
);