Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / common / extensions / api / cast_streaming_rtp_stream.idl
blobf1bae6eeaa4bc6c4a909844d6f05dcd654535a78
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
7 // session.
8 //
9 // Valid stream IDs are positive and non-zero.
10 namespace cast.streaming.rtpStream {
11 // Params for audio and video codec.
12 dictionary CodecSpecificParams {
13 DOMString key;
14 DOMString value;
17 // RTP payload param.
18 dictionary RtpPayloadParams {
19 long payloadType;
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.
25 long maxLatency;
27 DOMString codecName;
29 // Synchronization source identifier.
30 long ssrc;
32 long feedbackSsrc;
34 long? clockRate;
36 // Minimum bitrate in kilobits per second.
37 long? minBitrate;
39 // Maximum bitrate in kilobits per second.
40 long? maxBitrate;
42 // The number of channels.
43 long? channels;
45 // Video width in pixels.
46 long? width;
48 // Video height in pixels.
49 long? height;
51 // 16 bytes AES key encoded in Base64.
52 DOMString? aesKey;
54 // 16 bytes AES IV (Initialization vector) mask encoded in Base64.
55 DOMString? aesIvMask;
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);
87 interface Functions {
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);
124 interface Events {
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);