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

Side by Side Diff: content/renderer/pepper/content_decryptor_delegate.cc

Issue 261533002: Remove AudioBuffer::set_duration(), instead base on frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix divide by zero case. Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/base/audio_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/renderer/pepper/content_decryptor_delegate.h" 5 #include "content/renderer/pepper/content_decryptor_delegate.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 channel_ptrs[i] = cur + i * size_per_channel; 1019 channel_ptrs[i] = cur + i * size_per_channel;
1020 1020
1021 const int frame_count = frame_size / audio_bytes_per_frame; 1021 const int frame_count = frame_size / audio_bytes_per_frame;
1022 scoped_refptr<media::AudioBuffer> frame = media::AudioBuffer::CopyFrom( 1022 scoped_refptr<media::AudioBuffer> frame = media::AudioBuffer::CopyFrom(
1023 sample_format, 1023 sample_format,
1024 audio_channel_layout_, 1024 audio_channel_layout_,
1025 audio_channel_count_, 1025 audio_channel_count_,
1026 audio_samples_per_second_, 1026 audio_samples_per_second_,
1027 frame_count, 1027 frame_count,
1028 &channel_ptrs[0], 1028 &channel_ptrs[0],
1029 base::TimeDelta::FromMicroseconds(timestamp), 1029 base::TimeDelta::FromMicroseconds(timestamp));
1030 base::TimeDelta::FromMicroseconds(audio_samples_per_second_ /
1031 frame_count));
1032 frames->push_back(frame); 1030 frames->push_back(frame);
1033 1031
1034 cur += frame_size; 1032 cur += frame_size;
1035 bytes_left -= frame_size; 1033 bytes_left -= frame_size;
1036 } while (bytes_left > 0); 1034 } while (bytes_left > 0);
1037 1035
1038 return true; 1036 return true;
1039 } 1037 }
1040 1038
1041 void ContentDecryptorDelegate::SatisfyAllPendingCallbacksOnError() { 1039 void ContentDecryptorDelegate::SatisfyAllPendingCallbacksOnError() {
(...skipping 16 matching lines...) Expand all
1058 const media::Decryptor::AudioBuffers empty_frames; 1056 const media::Decryptor::AudioBuffers empty_frames;
1059 audio_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, 1057 audio_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError,
1060 empty_frames); 1058 empty_frames);
1061 } 1059 }
1062 1060
1063 if (!video_decode_cb_.is_null()) 1061 if (!video_decode_cb_.is_null())
1064 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); 1062 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL);
1065 } 1063 }
1066 1064
1067 } // namespace content 1065 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/base/audio_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698