OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 module media.mojom; | 5 module media.mojom; |
6 | 6 |
| 7 import "media/mojo/interfaces/remoting_common.mojom"; |
| 8 |
7 interface RemoterFactory { | 9 interface RemoterFactory { |
8 // Create a new Remoter associated with the given RemotingSource and bind it | 10 // Create a new Remoter associated with the given RemotingSource and bind it |
9 // to the given interface request. The RemotingSource will be notified when | 11 // to the given interface request. The RemotingSource will be notified when |
10 // the Remoter becomes available for use (or becomes unavailable). | 12 // the Remoter becomes available for use (or becomes unavailable). |
11 Create(RemotingSource source, Remoter& remoter); | 13 Create(RemotingSource source, Remoter& remoter); |
12 }; | 14 }; |
13 | 15 |
14 // Interface used by the source to control when media bitstream data is read | 16 // Interface used by the source to control when media bitstream data is read |
15 // from a data pipe and then sent to the remote endpoint. There is one | 17 // from a data pipe and then sent to the remote endpoint. There is one |
16 // RemotingDataStreamSender per data pipe. | 18 // RemotingDataStreamSender per data pipe. |
(...skipping 17 matching lines...) Expand all Loading... |
34 | 36 |
35 // Cancel the transmission of all in-flight data to the remote, up to and | 37 // Cancel the transmission of all in-flight data to the remote, up to and |
36 // including the last SendFrame() call; and also discard any data chunks | 38 // including the last SendFrame() call; and also discard any data chunks |
37 // that were consumed from the data pipe for the next frame. This is used to | 39 // that were consumed from the data pipe for the next frame. This is used to |
38 // optimize seeking, when it is known that any in-flight data is no longer | 40 // optimize seeking, when it is known that any in-flight data is no longer |
39 // needed by the remote. There is no guarantee as to how much of the in-flight | 41 // needed by the remote. There is no guarantee as to how much of the in-flight |
40 // data will actually reach the remote before the cancellation takes effect. | 42 // data will actually reach the remote before the cancellation takes effect. |
41 CancelInFlightData(); | 43 CancelInFlightData(); |
42 }; | 44 }; |
43 | 45 |
44 enum RemotingStopReason { | |
45 ROUTE_TERMINATED, // User-initiated disconnect, etc. | |
46 LOCAL_PLAYBACK, // Media switched back to local playback. | |
47 SOURCE_GONE, // RemotingSource has been destroyed. | |
48 MESSAGE_SEND_FAILED, // Failed to send a message to the sink. | |
49 DATA_SEND_FAILED, // Failed to consume from a data pipe or send to the sink. | |
50 UNEXPECTED_FAILURE, // Unexpected failure or inconsistent state encountered. | |
51 }; | |
52 | |
53 // Interface used by the source to start/stop remoting and send data to the | 46 // Interface used by the source to start/stop remoting and send data to the |
54 // sink. | 47 // sink. |
55 interface Remoter { | 48 interface Remoter { |
56 // Start a remoting session (once the sink has been reported to be available; | 49 // Start a remoting session (once the sink has been reported to be available; |
57 // see RemotingSource). Either RemotingSource.OnStarted() or OnStartFailed() | 50 // see RemotingSource). Either RemotingSource.OnStarted() or OnStartFailed() |
58 // will be called to indicate success or failure. Once OnStarted() has been | 51 // will be called to indicate success or failure. Once OnStarted() has been |
59 // invoked, the source may then make calls to SendMessageToSink() and expect | 52 // invoked, the source may then make calls to SendMessageToSink() and expect |
60 // messages from the remote via RemotingSource.OnMessageFromSink(). | 53 // messages from the remote via RemotingSource.OnMessageFromSink(). |
61 Start(); | 54 Start(); |
62 | 55 |
(...skipping 10 matching lines...) Expand all Loading... |
73 | 66 |
74 // Stop remoting media. Messages in both directions will be dropped after this | 67 // Stop remoting media. Messages in both directions will be dropped after this |
75 // point as well as any pending or in-transit media bitstream data. | 68 // point as well as any pending or in-transit media bitstream data. |
76 Stop(RemotingStopReason reason); | 69 Stop(RemotingStopReason reason); |
77 | 70 |
78 // Send |message| to the sink. |message| is a serialized protobuf from | 71 // Send |message| to the sink. |message| is a serialized protobuf from |
79 // src/media/remoting/proto. | 72 // src/media/remoting/proto. |
80 SendMessageToSink(array<uint8> message); | 73 SendMessageToSink(array<uint8> message); |
81 }; | 74 }; |
82 | 75 |
83 enum RemotingSinkCapabilities { | |
84 NONE, | |
85 RENDERING_ONLY, | |
86 CONTENT_DECRYPTION_AND_RENDERING, | |
87 }; | |
88 | |
89 enum RemotingStartFailReason { | |
90 CANNOT_START_MULTIPLE, // Remoting was already active. | |
91 ROUTE_TERMINATED, // User-initated disconnect while starting remoting. | |
92 }; | |
93 | |
94 // Interface used for sending notifications back to the local source's control | 76 // Interface used for sending notifications back to the local source's control |
95 // logic, and to pass messages from the sink back to the local media pipeline. | 77 // logic, and to pass messages from the sink back to the local media pipeline. |
96 interface RemotingSource { | 78 interface RemotingSource { |
97 // Notify the source that the sink is now available to start remoting. It is | 79 // Notify the source that the sink is now available to start remoting. It is |
98 // up to the source's control logic to decide whether/when to start remoting. | 80 // up to the source's control logic to decide whether/when to start remoting. |
99 // | 81 // |
100 // TODO(miu): In a later change, pass detailed information about the sink's | 82 // TODO(miu): In a later change, pass detailed information about the sink's |
101 // capabilities (e.g., codec support, DRM keysystem support, etc.). | 83 // capabilities (e.g., codec support, DRM keysystem support, etc.). |
102 OnSinkAvailable(RemotingSinkCapabilities capabilities); | 84 OnSinkAvailable(RemotingSinkCapabilities capabilities); |
103 | 85 |
(...skipping 13 matching lines...) Expand all Loading... |
117 // Pass a |message| from the sink back to the source. The |message| consists | 99 // Pass a |message| from the sink back to the source. The |message| consists |
118 // of a serialized protobuf from src/media/remoting/proto. This will only be | 100 // of a serialized protobuf from src/media/remoting/proto. This will only be |
119 // called after OnStarted() and before OnStopped(). | 101 // called after OnStarted() and before OnStopped(). |
120 OnMessageFromSink(array<uint8> message); | 102 OnMessageFromSink(array<uint8> message); |
121 | 103 |
122 // Notify the source that remoting has terminated. This may or may not be in | 104 // Notify the source that remoting has terminated. This may or may not be in |
123 // response to a Remoter.Stop() call, as other events (possibly external) may | 105 // response to a Remoter.Stop() call, as other events (possibly external) may |
124 // have caused remoting to end. | 106 // have caused remoting to end. |
125 OnStopped(RemotingStopReason reason); | 107 OnStopped(RemotingStopReason reason); |
126 }; | 108 }; |
OLD | NEW |