Index: chrome/renderer/media/cast_receiver_session_delegate.h |
diff --git a/chrome/renderer/media/cast_receiver_session_delegate.h b/chrome/renderer/media/cast_receiver_session_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..82180ac0658f0b47e4c8489ac2f6d38f7664e73f |
--- /dev/null |
+++ b/chrome/renderer/media/cast_receiver_session_delegate.h |
@@ -0,0 +1,60 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_DELEGATE_H_ |
+#define CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_DELEGATE_H_ |
+ |
+#include "chrome/renderer/media/cast_session_delegate.h" |
+#include "content/public/renderer/media_stream_video_sink.h" |
+#include "media/cast/cast_receiver.h" |
+#include "media/video/capture/video_capture_types.h" |
+ |
+class CastReceiverSessionDelegate : public CastSessionDelegateBase { |
+ public: |
+ CastReceiverSessionDelegate(); |
+ ~CastReceiverSessionDelegate() override; |
+ typedef base::Callback<void( |
+ const media::AudioBus*, int, double, bool)> AudioCB; |
+ |
+ void LogRawEvents( |
+ const std::vector<media::cast::PacketEvent>& packet_events, |
+ const std::vector<media::cast::FrameEvent>& frame_events) override; |
+ |
+ void Start(const media::cast::FrameReceiverConfig& audio_config, |
+ const media::cast::FrameReceiverConfig& video_config, |
+ const net::IPEndPoint& local_endpoint, |
+ const net::IPEndPoint& remote_endpoint, |
+ scoped_ptr<base::DictionaryValue> options, |
+ const media::VideoCaptureFormat& format); |
+ |
+ void StartAudio(AudioCB audio_callback); |
+ // Stop Audio callbacks and signal |event| when we know |
+ // that there will be no more callbacks. |
+ void StopAudio(base::WaitableEvent* event); |
+ |
+ void StartVideo(content::VideoCaptureDeliverFrameCB frame_callback); |
+ // Stop Video callbacks and signal |event| when we know |
+ // that there will be no more callbacks. |
+ void StopVideo(base::WaitableEvent* event); |
+ |
+ private: |
+ void OnDecodedAudioFrame(scoped_ptr<media::AudioBus> audio_bus, |
+ const base::TimeTicks& playout_time, |
+ bool is_continous); |
+ |
+ void OnDecodedVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, |
+ const base::TimeTicks& playout_time, |
+ bool is_continous); |
+ |
+ AudioCB audio_callback_; |
+ content::VideoCaptureDeliverFrameCB frame_callback_; |
+ media::cast::AudioFrameDecodedCallback on_audio_decoded_cb_; |
+ media::cast::VideoFrameDecodedCallback on_video_decoded_cb_; |
+ scoped_ptr<media::cast::CastReceiver> cast_receiver_; |
+ media::VideoCaptureFormat format_; |
+ base::WeakPtrFactory<CastReceiverSessionDelegate> weak_factory_; |
+ DISALLOW_COPY_AND_ASSIGN(CastReceiverSessionDelegate); |
+}; |
+ |
+#endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_SESSION_DELEGATE_H_ |