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

Side by Side Diff: media/cast/audio_receiver/audio_receiver.h

Issue 225023010: [Cast] Refactor/clean-up VideoReceiver to match AudioReceiver as closely as possible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 8 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
« no previous file with comments | « no previous file | media/cast/audio_receiver/audio_receiver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ 5 #ifndef MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_
6 #define MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ 6 #define MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 13 matching lines...) Expand all
24 #include "media/cast/rtp_receiver/rtp_receiver_defines.h" 24 #include "media/cast/rtp_receiver/rtp_receiver_defines.h"
25 #include "media/cast/transport/utility/transport_encryption_handler.h" 25 #include "media/cast/transport/utility/transport_encryption_handler.h"
26 26
27 namespace media { 27 namespace media {
28 namespace cast { 28 namespace cast {
29 29
30 class AudioDecoder; 30 class AudioDecoder;
31 31
32 // AudioReceiver receives packets out-of-order while clients make requests for 32 // AudioReceiver receives packets out-of-order while clients make requests for
33 // complete frames in-order. (A frame consists of one or more packets.) 33 // complete frames in-order. (A frame consists of one or more packets.)
34 // AudioReceiver also includes logic for mapping RTP timestamps to the local 34 //
35 // base::TimeTicks clock for each frame. 35 // AudioReceiver also includes logic for computing the playout time for each
36 // frame, accounting for a constant targeted playout delay. The purpose of the
37 // playout delay is to provide a fixed window of time between the capture event
38 // on the sender and the playout on the receiver. This is important because
39 // each step of the pipeline (i.e., encode frame, then transmit/retransmit from
40 // the sender, then receive and re-order packets on the receiver, then decode
41 // frame) can vary in duration and is typically very hard to predict.
42 // Heuristics will determine when the targeted playout delay is insufficient in
43 // the current environment; and the receiver can then increase the playout
44 // delay, notifying the sender, to account for the extra variance.
45 // TODO(miu): Make the last sentence true. http://crbug.com/360111
36 // 46 //
37 // Two types of frames can be requested: 1) A frame of decoded audio data; or 2) 47 // Two types of frames can be requested: 1) A frame of decoded audio data; or 2)
38 // a frame of still-encoded audio data, to be passed into an external audio 48 // a frame of still-encoded audio data, to be passed into an external audio
39 // decoder. Each request for a frame includes a callback which AudioReceiver 49 // decoder. Each request for a frame includes a callback which AudioReceiver
40 // guarantees will be called at some point in the future. Clients should 50 // guarantees will be called at some point in the future. Clients should
41 // generally limit the number of outstanding requests (perhaps to just one or 51 // generally limit the number of outstanding requests (perhaps to just one or
42 // two). When AudioReceiver is destroyed, any outstanding requests will be 52 // two). When AudioReceiver is destroyed, any outstanding requests will be
43 // immediately invoked with a NULL frame. 53 // immediately invoked with a NULL frame.
44 // 54 //
45 // This class is not thread safe. Should only be called from the Main cast 55 // This class is not thread safe. Should only be called from the Main cast
(...skipping 10 matching lines...) Expand all
56 virtual ~AudioReceiver(); 66 virtual ~AudioReceiver();
57 67
58 // Request a decoded audio frame. The audio signal data returned in the 68 // Request a decoded audio frame. The audio signal data returned in the
59 // callback will have the sampling rate and number of channels as requested in 69 // callback will have the sampling rate and number of channels as requested in
60 // the configuration that was passed to the ctor. 70 // the configuration that was passed to the ctor.
61 // 71 //
62 // The given |callback| is guaranteed to be run at some point in the future, 72 // The given |callback| is guaranteed to be run at some point in the future,
63 // even if to respond with NULL at shutdown time. 73 // even if to respond with NULL at shutdown time.
64 void GetRawAudioFrame(const AudioFrameDecodedCallback& callback); 74 void GetRawAudioFrame(const AudioFrameDecodedCallback& callback);
65 75
66 // Extract an encoded audio frame from the cast receiver. 76 // Request an encoded audio frame.
67 // 77 //
68 // The given |callback| is guaranteed to be run at some point in the future, 78 // The given |callback| is guaranteed to be run at some point in the future,
69 // even if to respond with NULL at shutdown time. 79 // even if to respond with NULL at shutdown time.
70 void GetEncodedAudioFrame(const AudioFrameEncodedCallback& callback); 80 void GetEncodedAudioFrame(const AudioFrameEncodedCallback& callback);
71 81
72 // Deliver another packet, possibly a duplicate, and possibly out-of-order. 82 // Deliver another packet, possibly a duplicate, and possibly out-of-order.
73 void IncomingPacket(scoped_ptr<Packet> packet); 83 void IncomingPacket(scoped_ptr<Packet> packet);
74 84
75 // Update target audio delay used to compute the playout time. Rtcp 85 // Update target audio delay used to compute the playout time. Rtcp
76 // will also be updated (will be included in all outgoing reports). 86 // will also be updated (will be included in all outgoing reports).
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // NOTE: Weak pointers must be invalidated before all other member variables. 176 // NOTE: Weak pointers must be invalidated before all other member variables.
167 base::WeakPtrFactory<AudioReceiver> weak_factory_; 177 base::WeakPtrFactory<AudioReceiver> weak_factory_;
168 178
169 DISALLOW_COPY_AND_ASSIGN(AudioReceiver); 179 DISALLOW_COPY_AND_ASSIGN(AudioReceiver);
170 }; 180 };
171 181
172 } // namespace cast 182 } // namespace cast
173 } // namespace media 183 } // namespace media
174 184
175 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ 185 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_
OLDNEW
« no previous file with comments | « no previous file | media/cast/audio_receiver/audio_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698