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

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

Issue 306783002: [Cast] Clean-up: Merge AudioReceiverConfig+VideoReceiverConfig-->FrameReceiverConfig. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed kFakeSoftwareAudio in AudioCodec enum, per hclam@. Created 6 years, 6 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_decoder.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_DECODER_H_ 5 #ifndef MEDIA_CAST_AUDIO_RECEIVER_AUDIO_DECODER_H_
6 #define MEDIA_CAST_AUDIO_RECEIVER_AUDIO_DECODER_H_ 6 #define MEDIA_CAST_AUDIO_RECEIVER_AUDIO_DECODER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "media/base/audio_bus.h" 10 #include "media/base/audio_bus.h"
11 #include "media/cast/cast_config.h" 11 #include "media/cast/cast_config.h"
12 #include "media/cast/cast_environment.h" 12 #include "media/cast/cast_environment.h"
13 #include "media/cast/transport/cast_transport_config.h" 13 #include "media/cast/transport/cast_transport_config.h"
14 14
15 namespace media { 15 namespace media {
16 namespace cast { 16 namespace cast {
17 17
18 class AudioDecoder { 18 class AudioDecoder {
19 public: 19 public:
20 // Callback passed to DecodeFrame, to deliver decoded audio data from the 20 // Callback passed to DecodeFrame, to deliver decoded audio data from the
21 // decoder. The number of samples in |audio_bus| may vary, and |audio_bus| 21 // decoder. The number of samples in |audio_bus| may vary, and |audio_bus|
22 // can be NULL when errors occur. |is_continuous| is normally true, but will 22 // can be NULL when errors occur. |is_continuous| is normally true, but will
23 // be false if the decoder has detected a frame skip since the last decode 23 // be false if the decoder has detected a frame skip since the last decode
24 // operation; and the client should take steps to smooth audio discontinuities 24 // operation; and the client should take steps to smooth audio discontinuities
25 // in this case. 25 // in this case.
26 typedef base::Callback<void(scoped_ptr<AudioBus> audio_bus, 26 typedef base::Callback<void(scoped_ptr<AudioBus> audio_bus,
27 bool is_continuous)> DecodeFrameCallback; 27 bool is_continuous)> DecodeFrameCallback;
28 28
29 AudioDecoder(const scoped_refptr<CastEnvironment>& cast_environment, 29 AudioDecoder(const scoped_refptr<CastEnvironment>& cast_environment,
30 const AudioReceiverConfig& audio_config); 30 const FrameReceiverConfig& audio_config);
31 virtual ~AudioDecoder(); 31 virtual ~AudioDecoder();
32 32
33 // Returns STATUS_AUDIO_INITIALIZED if the decoder was successfully 33 // Returns STATUS_AUDIO_INITIALIZED if the decoder was successfully
34 // constructed from the given AudioReceiverConfig. If this method returns any 34 // constructed from the given FrameReceiverConfig. If this method returns any
35 // other value, calls to DecodeFrame() will not succeed. 35 // other value, calls to DecodeFrame() will not succeed.
36 CastInitializationStatus InitializationResult() const; 36 CastInitializationStatus InitializationResult() const;
37 37
38 // Decode the payload in |encoded_frame| asynchronously. |callback| will be 38 // Decode the payload in |encoded_frame| asynchronously. |callback| will be
39 // invoked on the CastEnvironment::MAIN thread with the result. 39 // invoked on the CastEnvironment::MAIN thread with the result.
40 // 40 //
41 // In the normal case, |encoded_frame->frame_id| will be 41 // In the normal case, |encoded_frame->frame_id| will be
42 // monotonically-increasing by 1 for each successive call to this method. 42 // monotonically-increasing by 1 for each successive call to this method.
43 // When it is not, the decoder will assume one or more frames have been 43 // When it is not, the decoder will assume one or more frames have been
44 // dropped (e.g., due to packet loss), and will perform recovery actions. 44 // dropped (e.g., due to packet loss), and will perform recovery actions.
45 void DecodeFrame(scoped_ptr<transport::EncodedFrame> encoded_frame, 45 void DecodeFrame(scoped_ptr<transport::EncodedFrame> encoded_frame,
46 const DecodeFrameCallback& callback); 46 const DecodeFrameCallback& callback);
47 47
48 private: 48 private:
49 class ImplBase; 49 class ImplBase;
50 class OpusImpl; 50 class OpusImpl;
51 class Pcm16Impl; 51 class Pcm16Impl;
52 52
53 const scoped_refptr<CastEnvironment> cast_environment_; 53 const scoped_refptr<CastEnvironment> cast_environment_;
54 scoped_refptr<ImplBase> impl_; 54 scoped_refptr<ImplBase> impl_;
55 55
56 DISALLOW_COPY_AND_ASSIGN(AudioDecoder); 56 DISALLOW_COPY_AND_ASSIGN(AudioDecoder);
57 }; 57 };
58 58
59 } // namespace cast 59 } // namespace cast
60 } // namespace media 60 } // namespace media
61 61
62 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_DECODER_H_ 62 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | media/cast/audio_receiver/audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698