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_DELEGATE_H_
6 #define CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_DELEGATE_H_
8 #include "chrome/renderer/media/cast_receiver_audio_valve.h"
9 #include "chrome/renderer/media/cast_session_delegate.h"
10 #include "content/public/renderer/media_stream_video_sink.h"
11 #include "media/base/video_capture_types.h"
12 #include "media/cast/cast_receiver.h"
14 class CastReceiverSessionDelegate
: public CastSessionDelegateBase
{
16 typedef base::Callback
<void(const std::string
&)> ErrorCallback
;
18 CastReceiverSessionDelegate();
19 ~CastReceiverSessionDelegate() override
;
21 void ReceivePacket(scoped_ptr
<media::cast::Packet
> packet
) override
;
23 const std::vector
<media::cast::PacketEvent
>& packet_events
,
24 const std::vector
<media::cast::FrameEvent
>& frame_events
) override
;
26 void Start(const media::cast::FrameReceiverConfig
& audio_config
,
27 const media::cast::FrameReceiverConfig
& video_config
,
28 const net::IPEndPoint
& local_endpoint
,
29 const net::IPEndPoint
& remote_endpoint
,
30 scoped_ptr
<base::DictionaryValue
> options
,
31 const media::VideoCaptureFormat
& format
,
32 const ErrorCallback
& error_callback
);
34 void StartAudio(scoped_refptr
<CastReceiverAudioValve
> audio_valve
);
36 void StartVideo(content::VideoCaptureDeliverFrameCB frame_callback
);
37 // Stop Video callbacks (eventually).
41 void OnDecodedAudioFrame(scoped_ptr
<media::AudioBus
> audio_bus
,
42 const base::TimeTicks
& playout_time
,
45 void OnDecodedVideoFrame(const scoped_refptr
<media::VideoFrame
>& video_frame
,
46 const base::TimeTicks
& playout_time
,
49 scoped_refptr
<CastReceiverAudioValve
> audio_valve_
;
50 content::VideoCaptureDeliverFrameCB frame_callback_
;
51 media::cast::AudioFrameDecodedCallback on_audio_decoded_cb_
;
52 media::cast::VideoFrameDecodedCallback on_video_decoded_cb_
;
53 scoped_ptr
<media::cast::CastReceiver
> cast_receiver_
;
54 media::VideoCaptureFormat format_
;
55 base::WeakPtrFactory
<CastReceiverSessionDelegate
> weak_factory_
;
56 DISALLOW_COPY_AND_ASSIGN(CastReceiverSessionDelegate
);
59 #endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_DELEGATE_H_