Fire an error if a pref used in the UI is missing once all prefs are fetched.
[chromium-blink-merge.git] / chrome / renderer / media / cast_receiver_session.h
blobd2925220dcc8ec13b4629713e470c12e7024b4d1
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 "chrome/renderer/media/cast_receiver_session_delegate.h"
12 namespace blink {
13 class WebMediaStream;
16 namespace media {
17 class AudioCapturerSource;
18 class VideoCaptureFormat;
19 class VideoCapturerSource;
22 namespace net {
23 class IPEndPoint;
26 namespace base {
27 class DictionaryValue;
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();
36 typedef base::Callback<void(scoped_refptr<media::AudioCapturerSource>,
37 scoped_ptr<media::VideoCapturerSource>)> StartCB;
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 const CastReceiverSessionDelegate::ErrorCallback& error_callback);
55 private:
56 class VideoCapturerSource;
57 class AudioCapturerSource;
58 friend class base::RefCounted<CastReceiverSession>;
59 virtual ~CastReceiverSession();
60 void StartAudio(scoped_refptr<CastReceiverAudioValve> audio_valve);
62 void StartVideo(content::VideoCaptureDeliverFrameCB frame_callback);
63 // Stop Video callbacks.
64 // Note that this returns immediately, but callbacks do not stop immediately.
65 void StopVideo();
67 media::cast::FrameReceiverConfig audio_config_;
68 media::cast::FrameReceiverConfig video_config_;
69 scoped_ptr<CastReceiverSessionDelegate> delegate_;
70 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
71 media::VideoCaptureFormat format_;
73 DISALLOW_COPY_AND_ASSIGN(CastReceiverSession);
76 #endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_H_