| 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_RECEIVER_CAST_RECEIVER_IMPL_H_ | 5 #ifndef MEDIA_CAST_RECEIVER_CAST_RECEIVER_IMPL_H_ |
| 6 #define MEDIA_CAST_RECEIVER_CAST_RECEIVER_IMPL_H_ | 6 #define MEDIA_CAST_RECEIVER_CAST_RECEIVER_IMPL_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 "media/cast/cast_environment.h" | 10 #include "media/cast/cast_environment.h" |
| 11 #include "media/cast/cast_receiver.h" | 11 #include "media/cast/cast_receiver.h" |
| 12 #include "media/cast/common/rtp_time.h" |
| 12 #include "media/cast/net/pacing/paced_sender.h" | 13 #include "media/cast/net/pacing/paced_sender.h" |
| 13 #include "media/cast/receiver/frame_receiver.h" | 14 #include "media/cast/receiver/frame_receiver.h" |
| 14 | 15 |
| 15 namespace media { | 16 namespace media { |
| 16 namespace cast { | 17 namespace cast { |
| 17 | 18 |
| 18 class AudioDecoder; | 19 class AudioDecoder; |
| 19 class VideoDecoder; | 20 class VideoDecoder; |
| 20 | 21 |
| 21 // This is a pure owner class that groups all required receiver-related objects | 22 // This is a pure owner class that groups all required receiver-related objects |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 57 |
| 57 // Receives an AudioBus from |audio_decoder_|, logs the event, and passes the | 58 // Receives an AudioBus from |audio_decoder_|, logs the event, and passes the |
| 58 // data on by running the given |callback|. This method is static to ensure | 59 // data on by running the given |callback|. This method is static to ensure |
| 59 // it can be called after a CastReceiverImpl instance is destroyed. | 60 // it can be called after a CastReceiverImpl instance is destroyed. |
| 60 // DecodeEncodedAudioFrame() uses this as a callback for | 61 // DecodeEncodedAudioFrame() uses this as a callback for |
| 61 // AudioDecoder::DecodeFrame(). | 62 // AudioDecoder::DecodeFrame(). |
| 62 static void EmitDecodedAudioFrame( | 63 static void EmitDecodedAudioFrame( |
| 63 const scoped_refptr<CastEnvironment>& cast_environment, | 64 const scoped_refptr<CastEnvironment>& cast_environment, |
| 64 const AudioFrameDecodedCallback& callback, | 65 const AudioFrameDecodedCallback& callback, |
| 65 uint32 frame_id, | 66 uint32 frame_id, |
| 66 uint32 rtp_timestamp, | 67 RtpTimeTicks rtp_timestamp, |
| 67 const base::TimeTicks& playout_time, | 68 const base::TimeTicks& playout_time, |
| 68 scoped_ptr<AudioBus> audio_bus, | 69 scoped_ptr<AudioBus> audio_bus, |
| 69 bool is_continuous); | 70 bool is_continuous); |
| 70 | 71 |
| 71 // Receives a VideoFrame from |video_decoder_|, logs the event, and passes the | 72 // Receives a VideoFrame from |video_decoder_|, logs the event, and passes the |
| 72 // data on by running the given |callback|. This method is static to ensure | 73 // data on by running the given |callback|. This method is static to ensure |
| 73 // it can be called after a CastReceiverImpl instance is destroyed. | 74 // it can be called after a CastReceiverImpl instance is destroyed. |
| 74 // DecodeEncodedVideoFrame() uses this as a callback for | 75 // DecodeEncodedVideoFrame() uses this as a callback for |
| 75 // VideoDecoder::DecodeFrame(). | 76 // VideoDecoder::DecodeFrame(). |
| 76 static void EmitDecodedVideoFrame( | 77 static void EmitDecodedVideoFrame( |
| 77 const scoped_refptr<CastEnvironment>& cast_environment, | 78 const scoped_refptr<CastEnvironment>& cast_environment, |
| 78 const VideoFrameDecodedCallback& callback, | 79 const VideoFrameDecodedCallback& callback, |
| 79 uint32 frame_id, | 80 uint32 frame_id, |
| 80 uint32 rtp_timestamp, | 81 RtpTimeTicks rtp_timestamp, |
| 81 const base::TimeTicks& playout_time, | 82 const base::TimeTicks& playout_time, |
| 82 const scoped_refptr<VideoFrame>& video_frame, | 83 const scoped_refptr<VideoFrame>& video_frame, |
| 83 bool is_continuous); | 84 bool is_continuous); |
| 84 | 85 |
| 85 const scoped_refptr<CastEnvironment> cast_environment_; | 86 const scoped_refptr<CastEnvironment> cast_environment_; |
| 86 FrameReceiver audio_receiver_; | 87 FrameReceiver audio_receiver_; |
| 87 FrameReceiver video_receiver_; | 88 FrameReceiver video_receiver_; |
| 88 | 89 |
| 89 // Used by DispatchReceivedPacket() to direct packets to the appropriate frame | 90 // Used by DispatchReceivedPacket() to direct packets to the appropriate frame |
| 90 // receiver. | 91 // receiver. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 107 // images for playback. | 108 // images for playback. |
| 108 scoped_ptr<VideoDecoder> video_decoder_; | 109 scoped_ptr<VideoDecoder> video_decoder_; |
| 109 | 110 |
| 110 DISALLOW_COPY_AND_ASSIGN(CastReceiverImpl); | 111 DISALLOW_COPY_AND_ASSIGN(CastReceiverImpl); |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 } // namespace cast | 114 } // namespace cast |
| 114 } // namespace media | 115 } // namespace media |
| 115 | 116 |
| 116 #endif // MEDIA_CAST_RECEIVER_CAST_RECEIVER_IMPL_ | 117 #endif // MEDIA_CAST_RECEIVER_CAST_RECEIVER_IMPL_ |
| OLD | NEW |