Index: media/mojo/interfaces/mirror_service_remoting.mojom |
diff --git a/media/mojo/interfaces/mirror_service_remoting.mojom b/media/mojo/interfaces/mirror_service_remoting.mojom |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0ff50bacd63171e12745af09a9e854623c2c1a5e |
--- /dev/null |
+++ b/media/mojo/interfaces/mirror_service_remoting.mojom |
@@ -0,0 +1,63 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+module media.mojom; |
+ |
+import "media/mojo/interfaces/remoting_common.mojom"; |
+ |
+// Interface used by the source to start/stop remoting and send data to the |
+// sink. |
+interface MirrorServiceRemoter { |
+ // Start a remoting session. Either MirrorServiceRemotingSource.OnStarted() or |
imcheng
2017/06/22 01:13:27
Please use third person verbs when describing the
xjz
2017/06/23 19:02:42
Done.
|
+ // OnStartFailed() will be called to indicate success or failure. Once |
+ // OnStarted() has been invoked, the source may then make calls to |
+ // SendMessageToSink() and expect messages from the remote via |
+ // MirrorServiceRemotingSource.OnMessageFromSink(). |
+ Start(); |
+ |
+ // Start remoting the media data streams. This is called after Start() to |
+ // indicate audio/video bitstream data is ready to be consumed. |
+ StartDataStreams(bool has_audio, bool has_video); |
+ |
+ // Stop remoting media. Messages in both directions will be dropped after this |
+ // point as well as any pending or in-transit media bitstream data. |
+ Stop(media.mojom.RemotingStopReason reason); |
+ |
+ // Send |message| to the sink. |message| is a serialized protobuf from |
+ // src/media/remoting/proto. |
+ SendMessageToSink(array<uint8> message); |
+}; |
+ |
+// Interface used for sending notifications back to the source's control logic, |
+// and to pass messages from the sink back to the source. |
+interface MirrorServiceRemotingSource { |
+ // Notify the source that the sink is now available to start remoting. It is |
+ // up to the source's control logic to decide whether/when to start remoting. |
+ OnSinkAvailable(media.mojom.RemotingSinkCapabilities capabilities); |
+ |
+ // One of these is called after the source attempts to start remoting. If |
+ // OnStarted() is called, messages may begin flowing; and this will continue |
+ // until OnStopped() is called. On the other hand, if OnStartFailed() is |
+ // called, then no messages are being passed between source and sink and |
+ // remoting is not taking place. |
+ OnStarted(); |
+ OnStartFailed(media.mojom.RemotingStartFailReason reason); |
+ |
+ // Called after the remoting data streams are created. Setting the |
+ // |audio/video_stream_id| to -1 indicates there is no audio/video stream. |
+ OnDataStreamsStarted(int32 audio_stream_id, int32 video_stream_id); |
+ |
+ // Pass a |message| from the sink back to the source. The |message| consists |
+ // of a serialized protobuf from src/media/remoting/proto. This will only be |
+ // called after OnStarted() and before OnStopped(). |
+ OnMessageFromSink(array<uint8> message); |
+ |
+ // Notify the source that remoting has terminated. This may or may not be in |
+ // response to a Remoter.Stop() call, as other events (possibly external) may |
+ // have caused remoting to end. |
+ OnStopped(media.mojom.RemotingStopReason reason); |
+ |
+ // Notify the source that error occurs while streaming. |
+ OnError(); |
+}; |