Chromium Code Reviews| Index: chrome/renderer/media/cast_receiver_session.h |
| diff --git a/chrome/renderer/media/cast_receiver_session.h b/chrome/renderer/media/cast_receiver_session.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..51dede8e0826cc405decf34e07ea73fcfe90b554 |
| --- /dev/null |
| +++ b/chrome/renderer/media/cast_receiver_session.h |
| @@ -0,0 +1,78 @@ |
| +// Copyright 2015 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. |
| + |
| +#ifndef CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_H_ |
| +#define CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "chrome/renderer/media/cast_receiver_session_delegate.h" |
| + |
| +namespace blink { |
| +class WebMediaStream; |
| +} |
| + |
| +namespace media { |
| +class VideoCaptureFormat; |
| +} |
| + |
| +namespace net { |
| +class IPEndPoint; |
| +} |
| + |
| +namespace base { |
| +class DictionaryValue; |
| +} |
| + |
| +// This a render thread object, all methods, construction and |
| +// destruction must happen on the render thread. |
| +class CastReceiverSession : public base::RefCounted<CastReceiverSession> { |
| + public: |
| + CastReceiverSession(); |
| + |
| + typedef base::Callback<void(const blink::WebMediaStream)> StartCB; |
| + |
| + // Note that the cast receiver will start responding to |
| + // incoming network streams immediately, buffering input until |
| + // StartAudio/StartVideo is called. |
| + // Five first parameters are passed to cast receiver. |
| + // |start_callback| is called when initialization is done. |
| + // TODO(hubbe): Currently the audio component of the returned media |
| + // stream only the exact format that the sender is sending us. |
| + void Start(const media::cast::FrameReceiverConfig& audio_config, |
| + const media::cast::FrameReceiverConfig& video_config, |
| + const net::IPEndPoint& local_endpoint, |
| + const net::IPEndPoint& remote_endpoint, |
| + scoped_ptr<base::DictionaryValue> options, |
| + const media::VideoCaptureFormat& capture_format, |
| + const StartCB& start_callback); |
| + |
| + private: |
| + // friend class CastStreamingVideoSource; |
| + friend class CastStreamingVideoCapturerSource; |
| + friend class CastStreamingAudioCapturerSource; |
| + friend class base::RefCounted<CastReceiverSession>; |
| + virtual ~CastReceiverSession(); |
| + void StartAudio(scoped_refptr<CastReceiverAudioValve> audio_valve); |
| + |
| + void StartVideo(content::VideoCaptureDeliverFrameCB frame_callback); |
| + // Stop Video callbacks. |
| + // Note that this returns immediately, but callbacks do not |
| + // stop immediately. |
|
Alpha Left Google
2015/02/07 01:30:30
nit: This can go to the previous line.
hubbe
2015/02/09 20:13:32
Done.
|
| + void StopVideo(); |
| + |
| + const media::VideoCaptureFormat& format() { |
| + return format_; |
| + } |
| + |
| + const media::cast::FrameReceiverConfig audio_config_; |
| + const media::cast::FrameReceiverConfig video_config_; |
| + scoped_ptr<CastReceiverSessionDelegate> delegate_; |
| + const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| + media::VideoCaptureFormat format_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(CastReceiverSession); |
| +}; |
| + |
| +#endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_H_ |