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

Unified Diff: webkit/media/crypto/ppapi/clear_key_cdm.cc

Issue 11304010: Fix type punning error in (de)serializing audio frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 8 years, 2 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 | webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/media/crypto/ppapi/clear_key_cdm.cc
diff --git a/webkit/media/crypto/ppapi/clear_key_cdm.cc b/webkit/media/crypto/ppapi/clear_key_cdm.cc
index 033202924d341f1aded0668ac93130b185103284..7a7be26511abdccbc9d782e228f9787eb4b0ce5e 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);
« no previous file with comments | « no previous file | webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698