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

Unified Diff: media/base/audio_decoder_config.h

Issue 12638030: Make AudioDecoderConfig copyable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/base/audio_decoder_config.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_decoder_config.h
diff --git a/media/base/audio_decoder_config.h b/media/base/audio_decoder_config.h
index fa2994698eb834fd338d7538f72445996fc08641..455fea02062227b1cc06dde21c56241f1655483c 100644
--- a/media/base/audio_decoder_config.h
+++ b/media/base/audio_decoder_config.h
@@ -5,8 +5,9 @@
#ifndef MEDIA_BASE_AUDIO_DECODER_CONFIG_H_
#define MEDIA_BASE_AUDIO_DECODER_CONFIG_H_
+#include <vector>
+
#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
#include "media/base/channel_layout.h"
#include "media/base/media_export.h"
@@ -78,9 +79,6 @@ class MEDIA_EXPORT AudioDecoderConfig {
const uint8* extra_data, size_t extra_data_size,
bool is_encrypted, bool record_stats);
- // Deep copies |audio_config|.
- void CopyFrom(const AudioDecoderConfig& audio_config);
-
// Returns true if this object has appropriate configuration values, false
// otherwise.
bool IsValidConfig() const;
@@ -98,8 +96,10 @@ class MEDIA_EXPORT AudioDecoderConfig {
// Optional byte data required to initialize audio decoders such as Vorbis
// codebooks.
- uint8* extra_data() const { return extra_data_.get(); }
- size_t extra_data_size() const { return extra_data_size_; }
+ const uint8* extra_data() const {
+ return extra_data_.empty() ? NULL : &extra_data_[0];
+ }
+ size_t extra_data_size() const { return extra_data_.size(); }
// Whether the audio stream is potentially encrypted.
// Note that in a potentially encrypted audio stream, individual buffers
@@ -113,13 +113,12 @@ class MEDIA_EXPORT AudioDecoderConfig {
ChannelLayout channel_layout_;
int samples_per_second_;
int bytes_per_frame_;
-
- scoped_array<uint8> extra_data_;
- size_t extra_data_size_;
-
+ std::vector<uint8> extra_data_;
bool is_encrypted_;
- DISALLOW_COPY_AND_ASSIGN(AudioDecoderConfig);
+ // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
+ // generated copy constructor and assignment operator. Since the extra data is
+ // typically small, the performance impact is minimal.
};
} // namespace media
« no previous file with comments | « no previous file | media/base/audio_decoder_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698