summaryrefslogtreecommitdiffstats
path: root/chromecast/media/cma/ipc_streamer/audio_decoder_config_marshaller.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromecast/media/cma/ipc_streamer/audio_decoder_config_marshaller.cc')
-rw-r--r--chromecast/media/cma/ipc_streamer/audio_decoder_config_marshaller.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/chromecast/media/cma/ipc_streamer/audio_decoder_config_marshaller.cc b/chromecast/media/cma/ipc_streamer/audio_decoder_config_marshaller.cc
index d595bda..2bc40f4 100644
--- a/chromecast/media/cma/ipc_streamer/audio_decoder_config_marshaller.cc
+++ b/chromecast/media/cma/ipc_streamer/audio_decoder_config_marshaller.cc
@@ -4,6 +4,8 @@
#include "chromecast/media/cma/ipc_streamer/audio_decoder_config_marshaller.h"
+#include <vector>
+
#include "base/basictypes.h"
#include "base/logging.h"
#include "chromecast/media/cma/ipc/media_message.h"
@@ -24,9 +26,10 @@ void AudioDecoderConfigMarshaller::Write(
CHECK(msg->WritePod(config.samples_per_second()));
CHECK(msg->WritePod(config.sample_format()));
CHECK(msg->WritePod(config.is_encrypted()));
- CHECK(msg->WritePod(config.extra_data_size()));
- if (config.extra_data_size() > 0)
- CHECK(msg->WriteBuffer(config.extra_data(), config.extra_data_size()));
+ CHECK(msg->WritePod(config.extra_data().size()));
+ if (!config.extra_data().empty())
+ CHECK(msg->WriteBuffer(&config.extra_data()[0],
+ config.extra_data().size()));
}
// static
@@ -38,7 +41,7 @@ void AudioDecoderConfigMarshaller::Write(
int samples_per_second;
bool is_encrypted;
size_t extra_data_size;
- scoped_ptr<uint8[]> extra_data;
+ std::vector<uint8_t> extra_data;
CHECK(msg->ReadPod(&codec));
CHECK(msg->ReadPod(&channel_layout));
@@ -55,15 +58,14 @@ void AudioDecoderConfigMarshaller::Write(
CHECK_LE(sample_format, ::media::kSampleFormatMax);
CHECK_LT(extra_data_size, kMaxExtraDataSize);
if (extra_data_size > 0) {
- extra_data.reset(new uint8[extra_data_size]);
- CHECK(msg->ReadBuffer(extra_data.get(), extra_data_size));
+ extra_data.resize(extra_data_size);
+ CHECK(msg->ReadBuffer(&extra_data[0], extra_data.size()));
}
return ::media::AudioDecoderConfig(
codec, sample_format,
channel_layout, samples_per_second,
- extra_data.get(), extra_data_size,
- is_encrypted);
+ extra_data, is_encrypted);
}
} // namespace media