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

Side by Side Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 100195: Enable video in linux build and remove unneeded ifdefs to guard windows. (Closed)
Patch Set: Fix inifite loop. Created 11 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
« no previous file with comments | « media/base/media_posix.cc ('k') | media/filters/ffmpeg_demuxer.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) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "media/base/data_buffer.h" 5 #include "media/base/data_buffer.h"
6 #include "media/filters/ffmpeg_audio_decoder.h" 6 #include "media/filters/ffmpeg_audio_decoder.h"
7 #include "media/filters/ffmpeg_common.h" 7 #include "media/filters/ffmpeg_common.h"
8 #include "media/filters/ffmpeg_demuxer.h" 8 #include "media/filters/ffmpeg_demuxer.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 void FFmpegAudioDecoder::OnDecode(Buffer* input) { 71 void FFmpegAudioDecoder::OnDecode(Buffer* input) {
72 int16_t* output_buffer = reinterpret_cast<int16_t*>(output_buffer_.get()); 72 int16_t* output_buffer = reinterpret_cast<int16_t*>(output_buffer_.get());
73 int output_buffer_size = kOutputBufferSize; 73 int output_buffer_size = kOutputBufferSize;
74 int result = avcodec_decode_audio2(codec_context_, 74 int result = avcodec_decode_audio2(codec_context_,
75 output_buffer, 75 output_buffer,
76 &output_buffer_size, 76 &output_buffer_size,
77 input->GetData(), 77 input->GetData(),
78 input->GetDataSize()); 78 input->GetDataSize());
79 79
80 if (result < 0 || output_buffer_size > kOutputBufferSize) { 80 // TODO(ajwong): Consider if kOutputBufferSize should just be an int instead
81 // of a size_t.
82 if (result < 0 ||
83 output_buffer_size < 0 ||
84 static_cast<size_t>(output_buffer_size) > kOutputBufferSize) {
81 host_->Error(PIPELINE_ERROR_DECODE); 85 host_->Error(PIPELINE_ERROR_DECODE);
82 } else if (result == 0) { 86 } else if (result == 0) {
83 // TODO(scherkus): does this mark EOS? Do we want to fulfill a read request 87 // TODO(scherkus): does this mark EOS? Do we want to fulfill a read request
84 // with zero size? 88 // with zero size?
85 } else { 89 } else {
86 DataBuffer* result_buffer = new DataBuffer(); 90 DataBuffer* result_buffer = new DataBuffer();
87 memcpy(result_buffer->GetWritableData(output_buffer_size), 91 memcpy(result_buffer->GetWritableData(output_buffer_size),
88 output_buffer, output_buffer_size); 92 output_buffer, output_buffer_size);
89 result_buffer->SetTimestamp(input->GetTimestamp()); 93 result_buffer->SetTimestamp(input->GetTimestamp());
90 result_buffer->SetDuration(input->GetDuration()); 94 result_buffer->SetDuration(input->GetDuration());
91 EnqueueResult(result_buffer); 95 EnqueueResult(result_buffer);
92 } 96 }
93 } 97 }
94 98
95 } // namespace 99 } // namespace
OLDNEW
« no previous file with comments | « media/base/media_posix.cc ('k') | media/filters/ffmpeg_demuxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698