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.webrtc.castSendTransport</code> API takes a track as
6 // a source of media, and sends that media on the inner transport according to
7 // the given RtpParams.
8 namespace webrtc.castSendTransport {
9 // Params for audio and video codec.
10 dictionary CodecSpecificParam {
16 dictionary RtpPayloadParam {
21 // Synchronization source identifier.
30 // The number of channels.
33 // Video width in pixels.
36 // Video height in pixels.
39 // A list of codec specific params.
40 CodecSpecificParam[] codecSpecficParams;
43 // Cast transport capabilities
44 dictionary CastTransportCaps {
45 // RTP payload params.
46 RtpPayloadParam[] payloads;
48 DOMString[] rtcpFeatures;
50 DOMString[] fecMechanisms;
53 // Cast transport params.
54 dictionary CastTransportParams {
55 // RTP payload params.
56 RtpPayloadParam[] payloads;
58 DOMString[] rtcpFeatures;
60 DOMString[] fecMechanisms;
63 // Result of <code>create</code> call.
64 dictionary CreateInfo {
65 // The ID of the newly created transport.
69 // Callback from the <code>create</code> method.
70 // |id| : The transport id.
71 callback CreateCallback = void (CreateInfo info);
73 // Callback from the <code>createParams</code> method.
74 // |params| : The cast transport params.
75 callback CreateParamsCallback = void (CastTransportParams params);
77 // Callback from the <code>getCaps</code> method.
78 // |caps| : Capabilities of the cast transport.
79 callback GetCapsCallback = void (CastTransportCaps caps);
82 // Creates a cast send transport.
83 // |track| : the media track encoded by this transport.
84 // |innerTransportId| : the ID of the inner transport. The transport to be
85 // created will send data on the inner transport.
86 // |callback| : Called when the transport has been created.
87 [nocompile] static void create(
88 [instanceOf=MediaStreamTrack] object track,
89 long innerTransportId,
90 CreateCallback callback);
92 // Destroys a cast send transport.
93 // |transportId| : The transport ID.
94 [nocompile] static void destroy(long transportId);
96 // Creates suitable params given the capabilities.
97 // |caps| : the capabilities.
98 // |callback| : Called when the params have been created.
99 [nocompile] static void getCaps(long transportId,
100 GetCapsCallback callback);
102 // Creates suitable params given the capabilities.
103 // |transportId| : The transport ID.
104 // |remoteCaps| : Capabilities of remote peer.
105 // |callback| : Called when the params has been created.
106 [nocompile] static void createParams(
108 CastTransportCaps remoteCaps,
109 CreateParamsCallback callback);
111 // Starts to use the transport by providing remote params info.
112 // |transportId| : The transport ID.
113 // |params| : Parameters set for this transport.
114 [nocompile] static void start(long transportId,
115 CastTransportParams params);
117 // Stops using the transport.
118 // |transportId| : The transport ID.
119 [nocompile] static void stop(long transportId);
123 // Event fired when a cast send transport has started.
124 // |transportId| : The ID of the transport.
125 static void onStarted(long transportId);
127 // Event fired when a cast send transport has connected.
128 // After this event, the transport is ready to send the track.
129 // |transportId| : The ID of the transport.
130 static void onConnected(long transportId);
132 // Event fired when a cast send transport has stopped.
133 // |transportId| : The ID of the transport.
134 static void onStopped(long transportId);
136 // Event fired when a cast send transport has timeout.
137 // This happens when network has been congested for a while, or one side
139 // |transportId| : The ID of the transport.
140 static void onTimeout(long transportId);
142 // Event fired when a cast send transport has error.
143 // |transportId| : The ID of the transport.
144 // |errorString| : The error info.
145 static void onError(long transportId, DOMString errorString);