Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(567)

Unified Diff: chrome/renderer/media/cast_session_delegate.h

Issue 883293005: Cast: Basic cast_receiver API for chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed extra BUILD.gn line Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/media/cast_session.cc ('k') | chrome/renderer/media/cast_session_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/media/cast_session_delegate.h
diff --git a/chrome/renderer/media/cast_session_delegate.h b/chrome/renderer/media/cast_session_delegate.h
index fb0dd09793e166a92575d79ae3cc13b2ea7004ed..7528147ef7d722ed209ef5e4479aa5eb032fecbd 100644
--- a/chrome/renderer/media/cast_session_delegate.h
+++ b/chrome/renderer/media/cast_session_delegate.h
@@ -39,11 +39,45 @@ class CastTransportSender;
} // namespace cast
} // namespace media
+// Breaks out functionality that is common between CastSessionDelegate and
+// CastReceiverSessionDelegate.
+class CastSessionDelegateBase {
+ public:
+ CastSessionDelegateBase();
+ virtual ~CastSessionDelegateBase();
+
+ // This will start the session by configuring and creating the Cast transport
+ // and the Cast sender.
+ // Must be called before initialization of audio or video.
+ void StartUDP(const net::IPEndPoint& local_endpoint,
+ const net::IPEndPoint& remote_endpoint,
+ scoped_ptr<base::DictionaryValue> options);
+
+ protected:
+ void StatusNotificationCB(
+ media::cast::CastTransportStatus status);
+
+ virtual void ReceivePacket(scoped_ptr<media::cast::Packet> packet) = 0;
+ virtual void LogRawEvents(
+ const std::vector<media::cast::PacketEvent>& packet_events,
+ const std::vector<media::cast::FrameEvent>& frame_events) = 0;
+
+ base::ThreadChecker thread_checker_;
+ scoped_refptr<media::cast::CastEnvironment> cast_environment_;
+ scoped_ptr<media::cast::CastTransportSender> cast_transport_;
+
+ // Proxy to the IO message loop.
+ const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
+ base::WeakPtrFactory<CastSessionDelegateBase> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(CastSessionDelegateBase);
+};
+
// This class hosts CastSender and connects it to audio/video frame input
// and network socket.
// This class is created on the render thread and destroyed on the IO
// thread. All methods are accessible only on the IO thread.
-class CastSessionDelegate {
+class CastSessionDelegate : public CastSessionDelegateBase {
public:
typedef base::Callback<void(const scoped_refptr<
media::cast::AudioFrameInput>&)> AudioFrameInputAvailableCallback;
@@ -54,12 +88,10 @@ class CastSessionDelegate {
typedef base::Callback<void(const std::string&)> ErrorCallback;
CastSessionDelegate();
- virtual ~CastSessionDelegate();
+ ~CastSessionDelegate() override;
- // This will start the session by configuring and creating the Cast transport
- // and the Cast sender.
- // Must be called before initialization of audio or video.
- void StartUDP(const net::IPEndPoint& remote_endpoint,
+ void StartUDP(const net::IPEndPoint& local_endpoint,
+ const net::IPEndPoint& remote_endpoint,
scoped_ptr<base::DictionaryValue> options);
// After calling StartAudio() or StartVideo() encoding of that media will
@@ -99,25 +131,19 @@ class CastSessionDelegate {
media::cast::OperationalStatus result);
private:
- void StatusNotificationCB(
- media::cast::CastTransportStatus status);
-
+ void ReceivePacket(scoped_ptr<media::cast::Packet> packet) override;
// Adds logs collected from transport on browser side.
void LogRawEvents(const std::vector<media::cast::PacketEvent>& packet_events,
- const std::vector<media::cast::FrameEvent>& frame_events);
+ const std::vector<media::cast::FrameEvent>& frame_events)
+ override;
- base::ThreadChecker thread_checker_;
- scoped_refptr<media::cast::CastEnvironment> cast_environment_;
scoped_ptr<media::cast::CastSender> cast_sender_;
- scoped_ptr<media::cast::CastTransportSender> cast_transport_;
AudioFrameInputAvailableCallback audio_frame_input_available_callback_;
VideoFrameInputAvailableCallback video_frame_input_available_callback_;
scoped_ptr<media::cast::RawEventSubscriberBundle> event_subscribers_;
- // Proxy to the IO message loop.
- scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
base::WeakPtrFactory<CastSessionDelegate> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CastSessionDelegate);
« no previous file with comments | « chrome/renderer/media/cast_session.cc ('k') | chrome/renderer/media/cast_session_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698