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

Side by Side Diff: media/base/decoder_buffer.h

Issue 10949029: Replace av_malloc with AlignedAlloc for memory allocation in DecoderBuffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolve Dale's comments. Created 8 years, 3 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/base/decoder_buffer.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // A specialized buffer for interfacing with audio / video decoders. 5 // A specialized buffer for interfacing with audio / video decoders.
6 // 6 //
7 // Specifically ensures that data is aligned and padded as necessary by the 7 // Specifically ensures that data is aligned and padded as necessary by the
8 // underlying decoding framework. On desktop platforms this means memory is 8 // underlying decoding framework. On desktop platforms this means memory is
9 // allocated using FFmpeg with particular alignment and padding requirements. 9 // allocated using FFmpeg with particular alignment and padding requirements.
10 // 10 //
11 // Also includes decoder specific functionality for decryption. 11 // Also includes decoder specific functionality for decryption.
12 12
13 #ifndef MEDIA_BASE_DECODER_BUFFER_H_ 13 #ifndef MEDIA_BASE_DECODER_BUFFER_H_
14 #define MEDIA_BASE_DECODER_BUFFER_H_ 14 #define MEDIA_BASE_DECODER_BUFFER_H_
15 15
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "build/build_config.h"
17 #include "media/base/buffers.h" 18 #include "media/base/buffers.h"
18 #include "media/base/decrypt_config.h" 19 #include "media/base/decrypt_config.h"
19 20
20 namespace media { 21 namespace media {
21 22
22 class MEDIA_EXPORT DecoderBuffer : public Buffer { 23 class MEDIA_EXPORT DecoderBuffer : public Buffer {
23 public: 24 public:
25 enum {
26 kPaddingSize = 16,
27 #if defined(ARCH_CPU_ARM_FAMILY)
28 kAlignmentSize = 16
29 #else
30 kAlignmentSize = 32
31 #endif
32 };
33
24 // Allocates buffer of size |buffer_size| >= 0. Buffer will be padded and 34 // Allocates buffer of size |buffer_size| >= 0. Buffer will be padded and
25 // aligned as necessary. 35 // aligned as necessary.
26 explicit DecoderBuffer(int buffer_size); 36 explicit DecoderBuffer(int buffer_size);
27 37
28 // Create a DecoderBuffer whose |data_| is copied from |data|. Buffer will be 38 // Create a DecoderBuffer whose |data_| is copied from |data|. Buffer will be
29 // padded and aligned as necessary. |data| must not be NULL and |size| >= 0. 39 // padded and aligned as necessary. |data| must not be NULL and |size| >= 0.
30 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size); 40 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size);
31 41
32 // Create a DecoderBuffer indicating we've reached end of stream. GetData() 42 // Create a DecoderBuffer indicating we've reached end of stream. GetData()
33 // and GetWritableData() will return NULL and GetDataSize() will return 0. 43 // and GetWritableData() will return NULL and GetDataSize() will return 0.
(...skipping 23 matching lines...) Expand all
57 67
58 // Constructor helper method for memory allocations. 68 // Constructor helper method for memory allocations.
59 void Initialize(); 69 void Initialize();
60 70
61 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); 71 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer);
62 }; 72 };
63 73
64 } // namespace media 74 } // namespace media
65 75
66 #endif // MEDIA_BASE_DECODER_BUFFER_H_ 76 #endif // MEDIA_BASE_DECODER_BUFFER_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/decoder_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698