Remove extra semicolon from autofill_messages.h.
[chromium-blink-merge.git] / media / cast / receiver / cast_receiver_impl.h
blob6cd6ba3d7fd5e379bdf17a260c0ce3808b552465
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_CAST_RECEIVER_CAST_RECEIVER_IMPL_H_
6 #define MEDIA_CAST_RECEIVER_CAST_RECEIVER_IMPL_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "media/cast/cast_config.h"
11 #include "media/cast/cast_environment.h"
12 #include "media/cast/cast_receiver.h"
13 #include "media/cast/net/pacing/paced_sender.h"
14 #include "media/cast/receiver/frame_receiver.h"
16 namespace media {
17 namespace cast {
19 class AudioDecoder;
20 class VideoDecoder;
22 // This is a pure owner class that groups all required receiver-related objects
23 // together, such as the paced packet sender, audio/video RTP frame receivers,
24 // and software decoders (created on-demand).
25 class CastReceiverImpl : public CastReceiver {
26 public:
27 CastReceiverImpl(scoped_refptr<CastEnvironment> cast_environment,
28 const FrameReceiverConfig& audio_config,
29 const FrameReceiverConfig& video_config,
30 CastTransportSender* const transport);
32 ~CastReceiverImpl() final;
34 // CastReceiver implementation.
35 void ReceivePacket(scoped_ptr<Packet> packet) final;
36 void RequestDecodedAudioFrame(
37 const AudioFrameDecodedCallback& callback) final;
38 void RequestEncodedAudioFrame(
39 const ReceiveEncodedFrameCallback& callback) final;
40 void RequestDecodedVideoFrame(
41 const VideoFrameDecodedCallback& callback) final;
42 void RequestEncodedVideoFrame(
43 const ReceiveEncodedFrameCallback& callback) final;
45 private:
46 // Feeds an EncodedFrame into |audio_decoder_|. RequestDecodedAudioFrame()
47 // uses this as a callback for RequestEncodedAudioFrame().
48 void DecodeEncodedAudioFrame(
49 const AudioFrameDecodedCallback& callback,
50 scoped_ptr<EncodedFrame> encoded_frame);
52 // Feeds an EncodedFrame into |video_decoder_|. RequestDecodedVideoFrame()
53 // uses this as a callback for RequestEncodedVideoFrame().
54 void DecodeEncodedVideoFrame(
55 const VideoFrameDecodedCallback& callback,
56 scoped_ptr<EncodedFrame> encoded_frame);
58 // Receives an AudioBus from |audio_decoder_|, logs the event, and passes the
59 // data on by running the given |callback|. This method is static to ensure
60 // it can be called after a CastReceiverImpl instance is destroyed.
61 // DecodeEncodedAudioFrame() uses this as a callback for
62 // AudioDecoder::DecodeFrame().
63 static void EmitDecodedAudioFrame(
64 const scoped_refptr<CastEnvironment>& cast_environment,
65 const AudioFrameDecodedCallback& callback,
66 uint32 frame_id,
67 uint32 rtp_timestamp,
68 const base::TimeTicks& playout_time,
69 scoped_ptr<AudioBus> audio_bus,
70 bool is_continuous);
72 // Receives a VideoFrame from |video_decoder_|, logs the event, and passes the
73 // data on by running the given |callback|. This method is static to ensure
74 // it can be called after a CastReceiverImpl instance is destroyed.
75 // DecodeEncodedVideoFrame() uses this as a callback for
76 // VideoDecoder::DecodeFrame().
77 static void EmitDecodedVideoFrame(
78 const scoped_refptr<CastEnvironment>& cast_environment,
79 const VideoFrameDecodedCallback& callback,
80 uint32 frame_id,
81 uint32 rtp_timestamp,
82 const base::TimeTicks& playout_time,
83 const scoped_refptr<VideoFrame>& video_frame,
84 bool is_continuous);
86 const scoped_refptr<CastEnvironment> cast_environment_;
87 FrameReceiver audio_receiver_;
88 FrameReceiver video_receiver_;
90 // Used by DispatchReceivedPacket() to direct packets to the appropriate frame
91 // receiver.
92 const uint32 ssrc_of_audio_sender_;
93 const uint32 ssrc_of_video_sender_;
95 // Parameters for the decoders that are created on-demand. The values here
96 // might be nonsense if the client of CastReceiverImpl never intends to use
97 // the internal software-based decoders.
98 const int num_audio_channels_;
99 const int audio_sampling_rate_;
100 const Codec audio_codec_;
101 const Codec video_codec_;
103 // Created on-demand to decode frames from |audio_receiver_| into AudioBuses
104 // for playback.
105 scoped_ptr<AudioDecoder> audio_decoder_;
107 // Created on-demand to decode frames from |video_receiver_| into VideoFrame
108 // images for playback.
109 scoped_ptr<VideoDecoder> video_decoder_;
111 DISALLOW_COPY_AND_ASSIGN(CastReceiverImpl);
114 } // namespace cast
115 } // namespace media
117 #endif // MEDIA_CAST_RECEIVER_CAST_RECEIVER_IMPL_