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

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

Issue 1905763002: Convert //media/cast from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « media/cast/net/udp_transport_unittest.cc ('k') | media/cast/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 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/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "media/base/audio_bus.h" 11 #include "media/base/audio_bus.h"
12 #include "media/cast/cast_environment.h" 12 #include "media/cast/cast_environment.h"
13 #include "media/cast/constants.h" 13 #include "media/cast/constants.h"
14 #include "media/cast/net/cast_transport_config.h" 14 #include "media/cast/net/cast_transport_config.h"
15 15
16 namespace media { 16 namespace media {
17 namespace cast { 17 namespace cast {
18 18
19 class AudioDecoder { 19 class AudioDecoder {
20 public: 20 public:
21 // Callback passed to DecodeFrame, to deliver decoded audio data from the 21 // Callback passed to DecodeFrame, to deliver decoded audio data from the
22 // decoder. The number of samples in |audio_bus| may vary, and |audio_bus| 22 // decoder. The number of samples in |audio_bus| may vary, and |audio_bus|
23 // can be NULL when errors occur. |is_continuous| is normally true, but will 23 // can be NULL when errors occur. |is_continuous| is normally true, but will
24 // be false if the decoder has detected a frame skip since the last decode 24 // be false if the decoder has detected a frame skip since the last decode
25 // operation; and the client should take steps to smooth audio discontinuities 25 // operation; and the client should take steps to smooth audio discontinuities
26 // in this case. 26 // in this case.
27 typedef base::Callback<void(scoped_ptr<AudioBus> audio_bus, 27 typedef base::Callback<void(std::unique_ptr<AudioBus> audio_bus,
28 bool is_continuous)> DecodeFrameCallback; 28 bool is_continuous)>
29 DecodeFrameCallback;
29 30
30 AudioDecoder(const scoped_refptr<CastEnvironment>& cast_environment, 31 AudioDecoder(const scoped_refptr<CastEnvironment>& cast_environment,
31 int channels, 32 int channels,
32 int sampling_rate, 33 int sampling_rate,
33 Codec codec); 34 Codec codec);
34 virtual ~AudioDecoder(); 35 virtual ~AudioDecoder();
35 36
36 // Returns STATUS_INITIALIZED if the decoder was successfully constructed. If 37 // Returns STATUS_INITIALIZED if the decoder was successfully constructed. If
37 // this method returns any other value, calls to DecodeFrame() will not 38 // this method returns any other value, calls to DecodeFrame() will not
38 // succeed. 39 // succeed.
39 OperationalStatus InitializationResult() const; 40 OperationalStatus InitializationResult() const;
40 41
41 // Decode the payload in |encoded_frame| asynchronously. |callback| will be 42 // Decode the payload in |encoded_frame| asynchronously. |callback| will be
42 // invoked on the CastEnvironment::MAIN thread with the result. 43 // invoked on the CastEnvironment::MAIN thread with the result.
43 // 44 //
44 // In the normal case, |encoded_frame->frame_id| will be 45 // In the normal case, |encoded_frame->frame_id| will be
45 // monotonically-increasing by 1 for each successive call to this method. 46 // monotonically-increasing by 1 for each successive call to this method.
46 // When it is not, the decoder will assume one or more frames have been 47 // When it is not, the decoder will assume one or more frames have been
47 // dropped (e.g., due to packet loss), and will perform recovery actions. 48 // dropped (e.g., due to packet loss), and will perform recovery actions.
48 void DecodeFrame(scoped_ptr<EncodedFrame> encoded_frame, 49 void DecodeFrame(std::unique_ptr<EncodedFrame> encoded_frame,
49 const DecodeFrameCallback& callback); 50 const DecodeFrameCallback& callback);
50 51
51 private: 52 private:
52 class ImplBase; 53 class ImplBase;
53 class OpusImpl; 54 class OpusImpl;
54 class Pcm16Impl; 55 class Pcm16Impl;
55 56
56 const scoped_refptr<CastEnvironment> cast_environment_; 57 const scoped_refptr<CastEnvironment> cast_environment_;
57 scoped_refptr<ImplBase> impl_; 58 scoped_refptr<ImplBase> impl_;
58 59
59 DISALLOW_COPY_AND_ASSIGN(AudioDecoder); 60 DISALLOW_COPY_AND_ASSIGN(AudioDecoder);
60 }; 61 };
61 62
62 } // namespace cast 63 } // namespace cast
63 } // namespace media 64 } // namespace media
64 65
65 #endif // MEDIA_CAST_RECEIVER_AUDIO_DECODER_H_ 66 #endif // MEDIA_CAST_RECEIVER_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « media/cast/net/udp_transport_unittest.cc ('k') | media/cast/receiver/audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698