Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / renderer / media / cast_receiver_session.h
blob5be3e1942c4022af9c79aeb8ce6144076defa848
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.
5 #ifndef CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_H_
6 #define CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_H_
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/single_thread_task_runner.h"
11 #include "chrome/renderer/media/cast_receiver_session_delegate.h"
13 namespace blink {
14 class WebMediaStream;
17 namespace media {
18 class AudioCapturerSource;
19 struct VideoCaptureFormat;
20 class VideoCapturerSource;
23 namespace net {
24 class IPEndPoint;
27 namespace base {
28 class DictionaryValue;
31 // This a render thread object, all methods, construction and
32 // destruction must happen on the render thread.
33 class CastReceiverSession : public base::RefCounted<CastReceiverSession> {
34 public:
35 CastReceiverSession();
37 typedef base::Callback<void(scoped_refptr<media::AudioCapturerSource>,
38 scoped_ptr<media::VideoCapturerSource>)> StartCB;
40 // Note that the cast receiver will start responding to
41 // incoming network streams immediately, buffering input until
42 // StartAudio/StartVideo is called.
43 // Five first parameters are passed to cast receiver.
44 // |start_callback| is called when initialization is done.
45 // TODO(hubbe): Currently the audio component of the returned media
46 // stream only the exact format that the sender is sending us.
47 void Start(const media::cast::FrameReceiverConfig& audio_config,
48 const media::cast::FrameReceiverConfig& video_config,
49 const net::IPEndPoint& local_endpoint,
50 const net::IPEndPoint& remote_endpoint,
51 scoped_ptr<base::DictionaryValue> options,
52 const media::VideoCaptureFormat& capture_format,
53 const StartCB& start_callback,
54 const CastReceiverSessionDelegate::ErrorCallback& error_callback);
56 private:
57 class VideoCapturerSource;
58 class AudioCapturerSource;
59 friend class base::RefCounted<CastReceiverSession>;
60 virtual ~CastReceiverSession();
61 void StartAudio(scoped_refptr<CastReceiverAudioValve> audio_valve);
63 void StartVideo(content::VideoCaptureDeliverFrameCB frame_callback);
64 // Stop Video callbacks.
65 // Note that this returns immediately, but callbacks do not stop immediately.
66 void StopVideo();
68 media::cast::FrameReceiverConfig audio_config_;
69 media::cast::FrameReceiverConfig video_config_;
70 scoped_ptr<CastReceiverSessionDelegate> delegate_;
71 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
72 media::VideoCaptureFormat format_;
74 DISALLOW_COPY_AND_ASSIGN(CastReceiverSession);
77 #endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_H_