blob: d94b83c645087a6e858586d70618679aa94009c8 [file] [log] [blame]
// Copyright 2020 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 mojom;
import "media/mojo/mojom/media_types.mojom";
// Renderer-implemented interface that is used to receive metadata for buffers.
interface CastStreamingBufferReceiver {
// Provide metadata for a buffer to the Cast Streaming Receiver in the
// renderer process. The buffer data itself is on the associated |data_pipe|,
// from AudioStreamInfo or VideoStreamInfo.
// This is called for every new buffer pushed in the associated |data_pipe|.
ProvideBuffer(media.mojom.DecoderBuffer buffer);
// Signals the audio decoder configuration has changed. After this call,
// CastStreamingBufferReceiver.ProvideBuffer() will be called on every new
// frame. The buffer data itself is on |data_pipe|.
OnNewAudioConfig(media.mojom.AudioDecoderConfig decoder_config,
handle<data_pipe_consumer> data_pipe);
// Signals the video configuration has changed. After this call,
// CastStreamingBufferReceiver.ProvideBuffer() will be called on every new
// frame. The buffer data itself is on |data_pipe|.
OnNewVideoConfig(media.mojom.VideoDecoderConfig decoder_config,
handle<data_pipe_consumer> data_pipe);
};
// Information about a Cast Streaming audio stream.
struct AudioStreamInfo {
// Audio decoder configuration.
media.mojom.AudioDecoderConfig decoder_config;
// Audio buffer metadata receiver.
pending_receiver<CastStreamingBufferReceiver> buffer_receiver;
// Mojo data pipe over which audio buffer data is sent.
handle<data_pipe_consumer> data_pipe;
};
// Information about a Cast Streaming video stream.
struct VideoStreamInfo {
// Video decoder configuration.
media.mojom.VideoDecoderConfig decoder_config;
// Video buffer metadata receiver.
pending_receiver<CastStreamingBufferReceiver> buffer_receiver;
// Mojo data pipe over which video buffer data is sent.
handle<data_pipe_consumer> data_pipe;
};
// Implemented by the renderer, used to start the Cast Streaming Session.
// Closure of the Mojo channel will trigger the end of the Cast Streaming
// Session.
interface CastStreamingReceiver {
// Used for synchronization between the browser and the renderer. The browser
// should invoke this after binding the interface, and wait for the reply
// callback to know when the renderer is ready to receive and render frames.
EnableReceiver() => ();
// Called when the streams have been successfully initialized. At least one of
// |audio_stream_info| or |video_stream_info| must be set. This will only be
// called once per the lifetime of CastStreamingReceiver. After this call,
// CastStreamingBufferReceiver.ProvideBuffer() will be called on every new
// frame.
OnStreamsInitialized(
AudioStreamInfo? audio_stream_info,
VideoStreamInfo? video_stream_info);
};