OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_DELEGATE_H_ | 5 #ifndef CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_DELEGATE_H_ |
6 #define CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_DELEGATE_H_ | 6 #define CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_DELEGATE_H_ |
7 | 7 |
8 #include "chrome/renderer/media/cast_receiver_audio_valve.h" | 8 #include "chrome/renderer/media/cast_receiver_audio_valve.h" |
9 #include "chrome/renderer/media/cast_session_delegate.h" | 9 #include "chrome/renderer/media/cast_session_delegate.h" |
10 #include "content/public/renderer/media_stream_video_sink.h" | 10 #include "content/public/renderer/media_stream_video_sink.h" |
11 #include "media/base/video_capture_types.h" | 11 #include "media/base/video_capture_types.h" |
12 #include "media/cast/cast_receiver.h" | 12 #include "media/cast/cast_receiver.h" |
13 | 13 |
14 class CastReceiverSessionDelegate : public CastSessionDelegateBase { | 14 class CastReceiverSessionDelegate : public CastSessionDelegateBase { |
15 public: | 15 public: |
| 16 typedef base::Callback<void(const std::string&)> ErrorCallback; |
| 17 |
16 CastReceiverSessionDelegate(); | 18 CastReceiverSessionDelegate(); |
17 ~CastReceiverSessionDelegate() override; | 19 ~CastReceiverSessionDelegate() override; |
18 | 20 |
19 void ReceivePacket(scoped_ptr<media::cast::Packet> packet) override; | 21 void ReceivePacket(scoped_ptr<media::cast::Packet> packet) override; |
20 void LogRawEvents( | 22 void LogRawEvents( |
21 const std::vector<media::cast::PacketEvent>& packet_events, | 23 const std::vector<media::cast::PacketEvent>& packet_events, |
22 const std::vector<media::cast::FrameEvent>& frame_events) override; | 24 const std::vector<media::cast::FrameEvent>& frame_events) override; |
23 | 25 |
24 void Start(const media::cast::FrameReceiverConfig& audio_config, | 26 void Start(const media::cast::FrameReceiverConfig& audio_config, |
25 const media::cast::FrameReceiverConfig& video_config, | 27 const media::cast::FrameReceiverConfig& video_config, |
26 const net::IPEndPoint& local_endpoint, | 28 const net::IPEndPoint& local_endpoint, |
27 const net::IPEndPoint& remote_endpoint, | 29 const net::IPEndPoint& remote_endpoint, |
28 scoped_ptr<base::DictionaryValue> options, | 30 scoped_ptr<base::DictionaryValue> options, |
29 const media::VideoCaptureFormat& format); | 31 const media::VideoCaptureFormat& format, |
| 32 const ErrorCallback& error_callback); |
30 | 33 |
31 void StartAudio(scoped_refptr<CastReceiverAudioValve> audio_valve); | 34 void StartAudio(scoped_refptr<CastReceiverAudioValve> audio_valve); |
32 | 35 |
33 void StartVideo(content::VideoCaptureDeliverFrameCB frame_callback); | 36 void StartVideo(content::VideoCaptureDeliverFrameCB frame_callback); |
34 // Stop Video callbacks (eventually). | 37 // Stop Video callbacks (eventually). |
35 void StopVideo(); | 38 void StopVideo(); |
36 | 39 |
37 private: | 40 private: |
38 void OnDecodedAudioFrame(scoped_ptr<media::AudioBus> audio_bus, | 41 void OnDecodedAudioFrame(scoped_ptr<media::AudioBus> audio_bus, |
39 const base::TimeTicks& playout_time, | 42 const base::TimeTicks& playout_time, |
40 bool is_continous); | 43 bool is_continous); |
41 | 44 |
42 void OnDecodedVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, | 45 void OnDecodedVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, |
43 const base::TimeTicks& playout_time, | 46 const base::TimeTicks& playout_time, |
44 bool is_continous); | 47 bool is_continous); |
45 | 48 |
46 scoped_refptr<CastReceiverAudioValve> audio_valve_; | 49 scoped_refptr<CastReceiverAudioValve> audio_valve_; |
47 content::VideoCaptureDeliverFrameCB frame_callback_; | 50 content::VideoCaptureDeliverFrameCB frame_callback_; |
48 media::cast::AudioFrameDecodedCallback on_audio_decoded_cb_; | 51 media::cast::AudioFrameDecodedCallback on_audio_decoded_cb_; |
49 media::cast::VideoFrameDecodedCallback on_video_decoded_cb_; | 52 media::cast::VideoFrameDecodedCallback on_video_decoded_cb_; |
50 scoped_ptr<media::cast::CastReceiver> cast_receiver_; | 53 scoped_ptr<media::cast::CastReceiver> cast_receiver_; |
51 media::VideoCaptureFormat format_; | 54 media::VideoCaptureFormat format_; |
52 base::WeakPtrFactory<CastReceiverSessionDelegate> weak_factory_; | 55 base::WeakPtrFactory<CastReceiverSessionDelegate> weak_factory_; |
53 DISALLOW_COPY_AND_ASSIGN(CastReceiverSessionDelegate); | 56 DISALLOW_COPY_AND_ASSIGN(CastReceiverSessionDelegate); |
54 }; | 57 }; |
55 | 58 |
56 #endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_DELEGATE_H_ | 59 #endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_DELEGATE_H_ |
OLD | NEW |