| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_ |
| 6 #define MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "media/base/audio_decoder.h" | 10 #include "media/base/audio_decoder.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // A helper method that creates data pipe and sets the data connection to | 56 // A helper method that creates data pipe and sets the data connection to |
| 57 // the service. | 57 // the service. |
| 58 void CreateDataPipe(); | 58 void CreateDataPipe(); |
| 59 | 59 |
| 60 // A helper method to serialize the data section of DecoderBuffer into pipe. | 60 // A helper method to serialize the data section of DecoderBuffer into pipe. |
| 61 interfaces::DecoderBufferPtr TransferDecoderBuffer( | 61 interfaces::DecoderBufferPtr TransferDecoderBuffer( |
| 62 const scoped_refptr<DecoderBuffer>& media_buffer); | 62 const scoped_refptr<DecoderBuffer>& media_buffer); |
| 63 | 63 |
| 64 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 64 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 65 | 65 |
| 66 // This class is constructed on one thread and used exclusively on another |
| 67 // thread. This member is used to safely pass the AudioDecoderPtr from one |
| 68 // thread to another. It is set in the constructor and is consumed in |
| 69 // Initialize(). |
| 70 interfaces::AudioDecoderPtrInfo remote_decoder_info_; |
| 71 |
| 66 interfaces::AudioDecoderPtr remote_decoder_; | 72 interfaces::AudioDecoderPtr remote_decoder_; |
| 67 | 73 |
| 68 // DataPipe for serializing the data section of DecoderBuffer. | 74 // DataPipe for serializing the data section of DecoderBuffer. |
| 69 mojo::ScopedDataPipeProducerHandle producer_handle_; | 75 mojo::ScopedDataPipeProducerHandle producer_handle_; |
| 70 | 76 |
| 71 // Binding for AudioDecoderClient, bound to the |task_runner_|. | 77 // Binding for AudioDecoderClient, bound to the |task_runner_|. |
| 72 mojo::Binding<AudioDecoderClient> binding_; | 78 mojo::Binding<AudioDecoderClient> binding_; |
| 73 | 79 |
| 74 // We call the following callbacks to pass the information to the pipeline. | 80 // We call the following callbacks to pass the information to the pipeline. |
| 75 // |output_cb_| is permanent while other three are called only once, | 81 // |output_cb_| is permanent while other three are called only once, |
| 76 // |decode_cb_| and |reset_cb_| are replaced by every by Decode() and Reset(). | 82 // |decode_cb_| and |reset_cb_| are replaced by every by Decode() and Reset(). |
| 77 InitCB init_cb_; | 83 InitCB init_cb_; |
| 78 OutputCB output_cb_; | 84 OutputCB output_cb_; |
| 79 DecodeCB decode_cb_; | 85 DecodeCB decode_cb_; |
| 80 base::Closure reset_cb_; | 86 base::Closure reset_cb_; |
| 81 | 87 |
| 82 // Flag that is set if we got connection error. Never cleared. | 88 // Flag that is set if we got connection error. Never cleared. |
| 83 bool has_connection_error_; | 89 bool has_connection_error_; |
| 84 | 90 |
| 85 // Flag telling whether this decoder requires bitstream conversion. | 91 // Flag telling whether this decoder requires bitstream conversion. |
| 86 // Passed from |remote_decoder_| as a result of its initialization. | 92 // Passed from |remote_decoder_| as a result of its initialization. |
| 87 bool needs_bitstream_conversion_; | 93 bool needs_bitstream_conversion_; |
| 88 | 94 |
| 89 DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoder); | 95 DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoder); |
| 90 }; | 96 }; |
| 91 | 97 |
| 92 } // namespace media | 98 } // namespace media |
| 93 | 99 |
| 94 #endif // MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_ | 100 #endif // MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_ |
| OLD | NEW |