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

Side by Side Diff: media/cast/test/utility/in_process_receiver.h

Issue 388663003: Cast: Reshuffle files under media/cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missing includes Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_ 5 #ifndef MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_
6 #define MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_ 6 #define MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "media/base/audio_bus.h" 11 #include "media/base/audio_bus.h"
12 #include "media/cast/cast_config.h" 12 #include "media/cast/cast_config.h"
13 #include "media/cast/transport/cast_transport_config.h" 13 #include "media/cast/net/cast_transport_config.h"
14 #include "net/base/ip_endpoint.h"
14 15
15 namespace base { 16 namespace base {
16 class TimeTicks; 17 class TimeTicks;
17 class WaitableEvent; 18 class WaitableEvent;
18 } // namespace base 19 } // namespace base
19 20
20 namespace net { 21 namespace net {
21 class IPEndPoint; 22 class IPEndPoint;
22 } // namespace net 23 } // namespace net
23 24
24 namespace media { 25 namespace media {
25 26
26 class VideoFrame; 27 class VideoFrame;
27 28
28 namespace cast { 29 namespace cast {
29 30
30 class CastEnvironment; 31 class CastEnvironment;
31 class CastReceiver; 32 class CastReceiver;
32
33 namespace transport {
34 class UdpTransport; 33 class UdpTransport;
35 } // namespace transport
36 34
37 // Common base functionality for an in-process Cast receiver. This is meant to 35 // Common base functionality for an in-process Cast receiver. This is meant to
38 // be subclassed with the OnAudioFrame() and OnVideoFrame() methods implemented, 36 // be subclassed with the OnAudioFrame() and OnVideoFrame() methods implemented,
39 // so that the implementor can focus on what is to be done with the frames, 37 // so that the implementor can focus on what is to be done with the frames,
40 // rather than on the boilerplate "glue" code. 38 // rather than on the boilerplate "glue" code.
41 class InProcessReceiver { 39 class InProcessReceiver {
42 public: 40 public:
43 // Construct a receiver with the given configuration. |remote_end_point| can 41 // Construct a receiver with the given configuration. |remote_end_point| can
44 // be left empty, if the transport should automatically mate with the first 42 // be left empty, if the transport should automatically mate with the first
45 // remote sender it encounters. 43 // remote sender it encounters.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // |transport_| receiving, and requests the first audio/video frame. 76 // |transport_| receiving, and requests the first audio/video frame.
79 // Subclasses may override to provide additional start-up functionality. 77 // Subclasses may override to provide additional start-up functionality.
80 virtual void StartOnMainThread(); 78 virtual void StartOnMainThread();
81 79
82 // Helper method that destroys |transport_| and |cast_receiver_|. 80 // Helper method that destroys |transport_| and |cast_receiver_|.
83 // Subclasses may override to provide additional start-up functionality. 81 // Subclasses may override to provide additional start-up functionality.
84 virtual void StopOnMainThread(base::WaitableEvent* event); 82 virtual void StopOnMainThread(base::WaitableEvent* event);
85 83
86 // Callback for the transport to notify of status changes. A default 84 // Callback for the transport to notify of status changes. A default
87 // implementation is provided here that simply logs socket errors. 85 // implementation is provided here that simply logs socket errors.
88 virtual void UpdateCastTransportStatus(transport::CastTransportStatus status); 86 virtual void UpdateCastTransportStatus(CastTransportStatus status);
89 87
90 private: 88 private:
91 friend class base::RefCountedThreadSafe<InProcessReceiver>; 89 friend class base::RefCountedThreadSafe<InProcessReceiver>;
92 90
93 // CastReceiver callbacks that receive a frame and then request another. See 91 // CastReceiver callbacks that receive a frame and then request another. See
94 // comments for the callbacks defined in src/media/cast/cast_receiver.h for 92 // comments for the callbacks defined in src/media/cast/cast_receiver.h for
95 // argument description and semantics. 93 // argument description and semantics.
96 void GotAudioFrame(scoped_ptr<AudioBus> audio_frame, 94 void GotAudioFrame(scoped_ptr<AudioBus> audio_frame,
97 const base::TimeTicks& playout_time, 95 const base::TimeTicks& playout_time,
98 bool is_continuous); 96 bool is_continuous);
99 void GotVideoFrame(const scoped_refptr<VideoFrame>& video_frame, 97 void GotVideoFrame(const scoped_refptr<VideoFrame>& video_frame,
100 const base::TimeTicks& playout_time, 98 const base::TimeTicks& playout_time,
101 bool is_continuous); 99 bool is_continuous);
102 void PullNextAudioFrame(); 100 void PullNextAudioFrame();
103 void PullNextVideoFrame(); 101 void PullNextVideoFrame();
104 102
105 const scoped_refptr<CastEnvironment> cast_environment_; 103 const scoped_refptr<CastEnvironment> cast_environment_;
106 const net::IPEndPoint local_end_point_; 104 const net::IPEndPoint local_end_point_;
107 const net::IPEndPoint remote_end_point_; 105 const net::IPEndPoint remote_end_point_;
108 const FrameReceiverConfig audio_config_; 106 const FrameReceiverConfig audio_config_;
109 const FrameReceiverConfig video_config_; 107 const FrameReceiverConfig video_config_;
110 108
111 scoped_ptr<transport::UdpTransport> transport_; 109 scoped_ptr<UdpTransport> transport_;
112 scoped_ptr<CastReceiver> cast_receiver_; 110 scoped_ptr<CastReceiver> cast_receiver_;
113 111
114 // NOTE: Weak pointers must be invalidated before all other member variables. 112 // NOTE: Weak pointers must be invalidated before all other member variables.
115 base::WeakPtrFactory<InProcessReceiver> weak_factory_; 113 base::WeakPtrFactory<InProcessReceiver> weak_factory_;
116 114
117 DISALLOW_COPY_AND_ASSIGN(InProcessReceiver); 115 DISALLOW_COPY_AND_ASSIGN(InProcessReceiver);
118 }; 116 };
119 117
120 } // namespace cast 118 } // namespace cast
121 } // namespace media 119 } // namespace media
122 120
123 #endif // MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_ 121 #endif // MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_
OLDNEW
« no previous file with comments | « media/cast/test/utility/default_config.cc ('k') | media/cast/test/utility/in_process_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698