OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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. |
| 4 |
| 5 #ifndef CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_H_ |
| 6 #define CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "chrome/renderer/media/cast_receiver_session_delegate.h" |
| 11 |
| 12 namespace blink { |
| 13 class WebMediaStream; |
| 14 } |
| 15 |
| 16 namespace media { |
| 17 class AudioCapturerSource; |
| 18 class VideoCaptureFormat; |
| 19 class VideoCapturerSource; |
| 20 } |
| 21 |
| 22 namespace net { |
| 23 class IPEndPoint; |
| 24 } |
| 25 |
| 26 namespace base { |
| 27 class DictionaryValue; |
| 28 } |
| 29 |
| 30 // This a render thread object, all methods, construction and |
| 31 // destruction must happen on the render thread. |
| 32 class CastReceiverSession : public base::RefCounted<CastReceiverSession> { |
| 33 public: |
| 34 CastReceiverSession(); |
| 35 |
| 36 typedef base::Callback<void(scoped_refptr<media::AudioCapturerSource>, |
| 37 scoped_ptr<media::VideoCapturerSource>)> StartCB; |
| 38 |
| 39 // Note that the cast receiver will start responding to |
| 40 // incoming network streams immediately, buffering input until |
| 41 // StartAudio/StartVideo is called. |
| 42 // Five first parameters are passed to cast receiver. |
| 43 // |start_callback| is called when initialization is done. |
| 44 // TODO(hubbe): Currently the audio component of the returned media |
| 45 // stream only the exact format that the sender is sending us. |
| 46 void Start(const media::cast::FrameReceiverConfig& audio_config, |
| 47 const media::cast::FrameReceiverConfig& video_config, |
| 48 const net::IPEndPoint& local_endpoint, |
| 49 const net::IPEndPoint& remote_endpoint, |
| 50 scoped_ptr<base::DictionaryValue> options, |
| 51 const media::VideoCaptureFormat& capture_format, |
| 52 const StartCB& start_callback); |
| 53 |
| 54 private: |
| 55 class VideoCapturerSource; |
| 56 class AudioCapturerSource; |
| 57 friend class base::RefCounted<CastReceiverSession>; |
| 58 virtual ~CastReceiverSession(); |
| 59 void StartAudio(scoped_refptr<CastReceiverAudioValve> audio_valve); |
| 60 |
| 61 void StartVideo(content::VideoCaptureDeliverFrameCB frame_callback); |
| 62 // Stop Video callbacks. |
| 63 // Note that this returns immediately, but callbacks do not stop immediately. |
| 64 void StopVideo(); |
| 65 |
| 66 media::cast::FrameReceiverConfig audio_config_; |
| 67 media::cast::FrameReceiverConfig video_config_; |
| 68 scoped_ptr<CastReceiverSessionDelegate> delegate_; |
| 69 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| 70 media::VideoCaptureFormat format_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(CastReceiverSession); |
| 73 }; |
| 74 |
| 75 #endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_H_ |
OLD | NEW |