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.
29 // Synchronization source identifier.
36 // Minimum bitrate in kilobits per second.
39 // Maximum bitrate in kilobits per second.
42 // The number of channels.
45 // Video width in pixels.
48 // Video height in pixels.
51 // 16 bytes AES key encoded in Base64.
54 // 16 bytes AES IV (Initialization vector) mask encoded in Base64.
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_converter.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 // |callback|: Called with the raw events.
114 [nocompile
] static
void getRawEvents
(
115 long streamId
, GetRawEventsCallback
callback);
117 // Get stats for a stream in the current session.
118 // |streamId|: Stream to get stats for.
119 // |callback|: Called with the stats.
120 [nocompile
] static
void getStats
(
121 long streamId
, GetStatsCallback
callback);
125 // Event fired when a Cast RTP stream has started.
126 // |streamId| : The ID of the RTP stream.
127 static
void onStarted
(long streamId
);
129 // Event fired when a Cast RTP stream has stopped.
130 // |streamId| : The ID of the RTP stream.
131 static
void onStopped
(long streamId
);
133 // Event fired when a Cast RTP stream has error.
134 // |streamId| : The ID of the RTP stream.
135 // |errorString| : The error info.
136 static
void onError
(long streamId
, DOMString errorString
);