| OLD | NEW |
| 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" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // so that the implementor can focus on what is to be done with the frames, | 39 // so that the implementor can focus on what is to be done with the frames, |
| 40 // rather than on the boilerplate "glue" code. | 40 // rather than on the boilerplate "glue" code. |
| 41 class InProcessReceiver { | 41 class InProcessReceiver { |
| 42 public: | 42 public: |
| 43 // Construct a receiver with the given configuration. |remote_end_point| can | 43 // Construct a receiver with the given configuration. |remote_end_point| can |
| 44 // be left empty, if the transport should automatically mate with the first | 44 // be left empty, if the transport should automatically mate with the first |
| 45 // remote sender it encounters. | 45 // remote sender it encounters. |
| 46 InProcessReceiver(const scoped_refptr<CastEnvironment>& cast_environment, | 46 InProcessReceiver(const scoped_refptr<CastEnvironment>& cast_environment, |
| 47 const net::IPEndPoint& local_end_point, | 47 const net::IPEndPoint& local_end_point, |
| 48 const net::IPEndPoint& remote_end_point, | 48 const net::IPEndPoint& remote_end_point, |
| 49 const AudioReceiverConfig& audio_config, | 49 const FrameReceiverConfig& audio_config, |
| 50 const VideoReceiverConfig& video_config); | 50 const FrameReceiverConfig& video_config); |
| 51 | 51 |
| 52 virtual ~InProcessReceiver(); | 52 virtual ~InProcessReceiver(); |
| 53 | 53 |
| 54 // Convenience accessors. | 54 // Convenience accessors. |
| 55 scoped_refptr<CastEnvironment> cast_env() const { return cast_environment_; } | 55 scoped_refptr<CastEnvironment> cast_env() const { return cast_environment_; } |
| 56 const AudioReceiverConfig& audio_config() const { return audio_config_; } | 56 const FrameReceiverConfig& audio_config() const { return audio_config_; } |
| 57 const VideoReceiverConfig& video_config() const { return video_config_; } | 57 const FrameReceiverConfig& video_config() const { return video_config_; } |
| 58 | 58 |
| 59 // Begin delivering any received audio/video frames to the OnXXXFrame() | 59 // Begin delivering any received audio/video frames to the OnXXXFrame() |
| 60 // methods. | 60 // methods. |
| 61 virtual void Start(); | 61 virtual void Start(); |
| 62 | 62 |
| 63 // Destroy the sub-compontents of this class. | 63 // Destroy the sub-compontents of this class. |
| 64 // After this call, it is safe to destroy this object on any thread. | 64 // After this call, it is safe to destroy this object on any thread. |
| 65 virtual void Stop(); | 65 virtual void Stop(); |
| 66 | 66 |
| 67 protected: | 67 protected: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 98 bool is_continuous); | 98 bool is_continuous); |
| 99 void GotVideoFrame(const scoped_refptr<VideoFrame>& video_frame, | 99 void GotVideoFrame(const scoped_refptr<VideoFrame>& video_frame, |
| 100 const base::TimeTicks& playout_time, | 100 const base::TimeTicks& playout_time, |
| 101 bool is_continuous); | 101 bool is_continuous); |
| 102 void PullNextAudioFrame(); | 102 void PullNextAudioFrame(); |
| 103 void PullNextVideoFrame(); | 103 void PullNextVideoFrame(); |
| 104 | 104 |
| 105 const scoped_refptr<CastEnvironment> cast_environment_; | 105 const scoped_refptr<CastEnvironment> cast_environment_; |
| 106 const net::IPEndPoint local_end_point_; | 106 const net::IPEndPoint local_end_point_; |
| 107 const net::IPEndPoint remote_end_point_; | 107 const net::IPEndPoint remote_end_point_; |
| 108 const AudioReceiverConfig audio_config_; | 108 const FrameReceiverConfig audio_config_; |
| 109 const VideoReceiverConfig video_config_; | 109 const FrameReceiverConfig video_config_; |
| 110 | 110 |
| 111 scoped_ptr<transport::UdpTransport> transport_; | 111 scoped_ptr<transport::UdpTransport> transport_; |
| 112 scoped_ptr<CastReceiver> cast_receiver_; | 112 scoped_ptr<CastReceiver> cast_receiver_; |
| 113 | 113 |
| 114 // NOTE: Weak pointers must be invalidated before all other member variables. | 114 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 115 base::WeakPtrFactory<InProcessReceiver> weak_factory_; | 115 base::WeakPtrFactory<InProcessReceiver> weak_factory_; |
| 116 | 116 |
| 117 DISALLOW_COPY_AND_ASSIGN(InProcessReceiver); | 117 DISALLOW_COPY_AND_ASSIGN(InProcessReceiver); |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 } // namespace cast | 120 } // namespace cast |
| 121 } // namespace media | 121 } // namespace media |
| 122 | 122 |
| 123 #endif // MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_ | 123 #endif // MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_ |
| OLD | NEW |