Chromium Code Reviews| 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 VideoCaptureFormat; | |
| 18 } | |
| 19 | |
| 20 namespace net { | |
| 21 class IPEndPoint; | |
| 22 } | |
| 23 | |
| 24 namespace base { | |
| 25 class DictionaryValue; | |
| 26 } | |
| 27 | |
| 28 // This a render thread object, all methods, construction and | |
| 29 // destruction must happen on the render thread. | |
| 30 class CastReceiverSession : public base::RefCounted<CastReceiverSession> { | |
| 31 public: | |
| 32 CastReceiverSession(); | |
| 33 | |
| 34 typedef base::Callback<void(const blink::WebMediaStream)> StartCB; | |
| 35 | |
| 36 // Note that the cast receiver will start responding to | |
| 37 // incoming network streams immediately, buffering input until | |
| 38 // StartAudio/StartVideo is called. | |
| 39 // Five first parameters are passed to cast receiver. | |
| 40 // |start_callback| is called when initialization is done. | |
| 41 // TODO(hubbe): Currently the audio component of the returned media | |
| 42 // stream only the exact format that the sender is sending us. | |
| 43 void Start(const media::cast::FrameReceiverConfig& audio_config, | |
| 44 const media::cast::FrameReceiverConfig& video_config, | |
| 45 const net::IPEndPoint& local_endpoint, | |
| 46 const net::IPEndPoint& remote_endpoint, | |
| 47 scoped_ptr<base::DictionaryValue> options, | |
| 48 const media::VideoCaptureFormat& capture_format, | |
| 49 const StartCB& start_callback); | |
| 50 | |
| 51 private: | |
| 52 // friend class CastStreamingVideoSource; | |
| 53 friend class CastStreamingVideoCapturerSource; | |
|
miu
2015/02/11 02:52:50
Instead of friending, consider making these nested
hubbe
2015/02/11 22:38:17
Done.
| |
| 54 friend class CastStreamingAudioCapturerSource; | |
| 55 friend class base::RefCounted<CastReceiverSession>; | |
| 56 virtual ~CastReceiverSession(); | |
| 57 void StartAudio(scoped_refptr<CastReceiverAudioValve> audio_valve); | |
| 58 | |
| 59 void StartVideo(content::VideoCaptureDeliverFrameCB frame_callback); | |
| 60 // Stop Video callbacks. | |
| 61 // Note that this returns immediately, but callbacks do not stop immediately. | |
| 62 void StopVideo(); | |
| 63 | |
| 64 const media::VideoCaptureFormat& format() { | |
|
miu
2015/02/11 02:52:49
This is strange. Why call format() if format_ is
hubbe
2015/02/11 22:38:17
Removed.
| |
| 65 return format_; | |
| 66 } | |
| 67 | |
| 68 const media::cast::FrameReceiverConfig audio_config_; | |
| 69 const media::cast::FrameReceiverConfig video_config_; | |
| 70 scoped_ptr<CastReceiverSessionDelegate> delegate_; | |
| 71 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | |
| 72 media::VideoCaptureFormat format_; | |
| 73 | |
| 74 DISALLOW_COPY_AND_ASSIGN(CastReceiverSession); | |
| 75 }; | |
| 76 | |
| 77 #endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_H_ | |
| OLD | NEW |