summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webkit/media/crypto/ppapi/clear_key_cdm.cc8
-rw-r--r--webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc6
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc4
3 files changed, 10 insertions, 8 deletions
diff --git a/webkit/media/crypto/ppapi/clear_key_cdm.cc b/webkit/media/crypto/ppapi/clear_key_cdm.cc
index 0332029..7a7be26 100644
--- a/webkit/media/crypto/ppapi/clear_key_cdm.cc
+++ b/webkit/media/crypto/ppapi/clear_key_cdm.cc
@@ -485,10 +485,12 @@ int ClearKeyCdm::GenerateFakeAudioFramesFromDuration(
const int kHeaderSize = sizeof(timestamp) + sizeof(frame_size);
audio_frames->set_buffer(allocator_->Allocate(kHeaderSize + frame_size));
- int64* data = reinterpret_cast<int64*>(audio_frames->buffer()->data());
+ uint8_t* data = audio_frames->buffer()->data();
- *(data++) = timestamp;
- *(data++) = frame_size;
+ memcpy(data, &timestamp, sizeof(timestamp));
+ data += sizeof(timestamp);
+ memcpy(data, &frame_size, sizeof(frame_size));
+ data += sizeof(frame_size);
// You won't hear anything because we have all zeros here. But the video
// should play just fine!
memset(data, 0, frame_size);
diff --git a/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc b/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc
index a9d8923..e6f0d2d 100644
--- a/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc
+++ b/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc
@@ -333,9 +333,9 @@ base::TimeDelta FFmpegCdmAudioDecoder::GetNextOutputTimestamp() const {
}
void FFmpegCdmAudioDecoder::SerializeInt64(int64 value) {
- const uint8_t* ptr = reinterpret_cast<uint8_t*>(&value);
- serialized_audio_frames_.insert(serialized_audio_frames_.end(),
- ptr, ptr + sizeof(value));
+ int previous_size = serialized_audio_frames_.size();
+ serialized_audio_frames_.resize(previous_size + sizeof(value));
+ memcpy(&serialized_audio_frames_[0] + previous_size, &value, sizeof(value));
}
} // namespace webkit_media
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 749f469..cd78ea8 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -418,11 +418,11 @@ bool DeserializeAudioFrames(PP_Resource audio_frames,
if (bytes_left < kHeaderSize)
return false;
- timestamp = *(reinterpret_cast<const int64*>(cur));
+ memcpy(&timestamp, cur, sizeof(timestamp));
cur += sizeof(timestamp);
bytes_left -= sizeof(timestamp);
- frame_size = *(reinterpret_cast<const int64*>(cur));
+ memcpy(&frame_size, cur, sizeof(frame_size));
cur += sizeof(frame_size);
bytes_left -= sizeof(frame_size);