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

Side by Side Diff: webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc

Issue 11304010: Fix type punning error in (de)serializing audio frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
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 #include "webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h" 5 #include "webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/base/buffers.h" 10 #include "media/base/buffers.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 base::TimeDelta FFmpegCdmAudioDecoder::GetNextOutputTimestamp() const { 325 base::TimeDelta FFmpegCdmAudioDecoder::GetNextOutputTimestamp() const {
326 DCHECK(output_timestamp_base_ != media::kNoTimestamp()); 326 DCHECK(output_timestamp_base_ != media::kNoTimestamp());
327 const double total_frames_decoded = total_frames_decoded_; 327 const double total_frames_decoded = total_frames_decoded_;
328 const double decoded_us = (total_frames_decoded / samples_per_second_) * 328 const double decoded_us = (total_frames_decoded / samples_per_second_) *
329 base::Time::kMicrosecondsPerSecond; 329 base::Time::kMicrosecondsPerSecond;
330 return output_timestamp_base_ + 330 return output_timestamp_base_ +
331 base::TimeDelta::FromMicroseconds(decoded_us); 331 base::TimeDelta::FromMicroseconds(decoded_us);
332 } 332 }
333 333
334 void FFmpegCdmAudioDecoder::SerializeInt64(int64 value) { 334 void FFmpegCdmAudioDecoder::SerializeInt64(int64 value) {
335 const uint8_t* ptr = reinterpret_cast<uint8_t*>(&value); 335 uint8 data[sizeof(value)] = { 0 };
336 memcpy(data, &value, sizeof(value));
Ami GONE FROM CHROMIUM 2012/10/26 21:48:44 You could alternatively extend the vector by sizeo
xhwang 2012/10/26 22:28:13 Done.
336 serialized_audio_frames_.insert(serialized_audio_frames_.end(), 337 serialized_audio_frames_.insert(serialized_audio_frames_.end(),
337 ptr, ptr + sizeof(value)); 338 data, data + sizeof(value));
338 } 339 }
339 340
340 } // namespace webkit_media 341 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/crypto/ppapi/clear_key_cdm.cc ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698