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_AUDIO_DECODER_H_ | 5 #ifndef MEDIA_CAST_RECEIVER_AUDIO_DECODER_H_ |
6 #define MEDIA_CAST_RECEIVER_AUDIO_DECODER_H_ | 6 #define MEDIA_CAST_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" |
(...skipping 14 matching lines...) Expand all Loading... |
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 int channels, | 30 int channels, |
31 int sampling_rate, | 31 int sampling_rate, |
32 Codec codec); | 32 Codec codec); |
33 virtual ~AudioDecoder(); | 33 virtual ~AudioDecoder(); |
34 | 34 |
35 // Returns STATUS_AUDIO_INITIALIZED if the decoder was successfully | 35 // Returns STATUS_INITIALIZED if the decoder was successfully constructed from |
36 // constructed from the given FrameReceiverConfig. If this method returns any | 36 // the given FrameReceiverConfig. If this method returns any other value, |
37 // other value, calls to DecodeFrame() will not succeed. | 37 // calls to DecodeFrame() will not succeed. |
38 CastInitializationStatus InitializationResult() const; | 38 OperationalStatus InitializationResult() const; |
39 | 39 |
40 // Decode the payload in |encoded_frame| asynchronously. |callback| will be | 40 // Decode the payload in |encoded_frame| asynchronously. |callback| will be |
41 // invoked on the CastEnvironment::MAIN thread with the result. | 41 // invoked on the CastEnvironment::MAIN thread with the result. |
42 // | 42 // |
43 // In the normal case, |encoded_frame->frame_id| will be | 43 // In the normal case, |encoded_frame->frame_id| will be |
44 // monotonically-increasing by 1 for each successive call to this method. | 44 // monotonically-increasing by 1 for each successive call to this method. |
45 // When it is not, the decoder will assume one or more frames have been | 45 // When it is not, the decoder will assume one or more frames have been |
46 // dropped (e.g., due to packet loss), and will perform recovery actions. | 46 // dropped (e.g., due to packet loss), and will perform recovery actions. |
47 void DecodeFrame(scoped_ptr<EncodedFrame> encoded_frame, | 47 void DecodeFrame(scoped_ptr<EncodedFrame> encoded_frame, |
48 const DecodeFrameCallback& callback); | 48 const DecodeFrameCallback& callback); |
49 | 49 |
50 private: | 50 private: |
51 class ImplBase; | 51 class ImplBase; |
52 class OpusImpl; | 52 class OpusImpl; |
53 class Pcm16Impl; | 53 class Pcm16Impl; |
54 | 54 |
55 const scoped_refptr<CastEnvironment> cast_environment_; | 55 const scoped_refptr<CastEnvironment> cast_environment_; |
56 scoped_refptr<ImplBase> impl_; | 56 scoped_refptr<ImplBase> impl_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(AudioDecoder); | 58 DISALLOW_COPY_AND_ASSIGN(AudioDecoder); |
59 }; | 59 }; |
60 | 60 |
61 } // namespace cast | 61 } // namespace cast |
62 } // namespace media | 62 } // namespace media |
63 | 63 |
64 #endif // MEDIA_CAST_RECEIVER_AUDIO_DECODER_H_ | 64 #endif // MEDIA_CAST_RECEIVER_AUDIO_DECODER_H_ |
OLD | NEW |