| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "services/media/framework_ffmpeg/ffmpeg_audio_decoder.h" | 6 #include "services/media/framework_ffmpeg/ffmpeg_audio_decoder.h" |
| 7 | 7 |
| 8 namespace mojo { | 8 namespace mojo { |
| 9 namespace media { | 9 namespace media { |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 | 67 |
| 68 PacketPtr FfmpegAudioDecoder::CreateOutputPacket(const AVFrame& av_frame, | 68 PacketPtr FfmpegAudioDecoder::CreateOutputPacket(const AVFrame& av_frame, |
| 69 PayloadAllocator* allocator) { | 69 PayloadAllocator* allocator) { |
| 70 DCHECK(allocator); | 70 DCHECK(allocator); |
| 71 | 71 |
| 72 int64_t pts = av_frame.pts; | 72 int64_t pts = av_frame.pts; |
| 73 if (pts == AV_NOPTS_VALUE) { | 73 if (pts == AV_NOPTS_VALUE) { |
| 74 pts = next_pts_; | 74 pts = next_pts_; |
| 75 next_pts_ += av_frame.nb_samples; | 75 next_pts_ += av_frame.nb_samples; |
| 76 } else { |
| 77 next_pts_ = pts; |
| 76 } | 78 } |
| 77 | 79 |
| 78 uint64_t payload_size; | 80 uint64_t payload_size; |
| 79 void* payload_buffer; | 81 void* payload_buffer; |
| 80 | 82 |
| 81 AvBufferContext* av_buffer_context = | 83 AvBufferContext* av_buffer_context = |
| 82 reinterpret_cast<AvBufferContext*>(av_buffer_get_opaque(av_frame.buf[0])); | 84 reinterpret_cast<AvBufferContext*>(av_buffer_get_opaque(av_frame.buf[0])); |
| 83 | 85 |
| 84 if (lpcm_util_) { | 86 if (lpcm_util_) { |
| 85 // We need to interleave. The non-interleaved frames are in a buffer that | 87 // We need to interleave. The non-interleaved frames are in a buffer that |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 DCHECK(av_buffer_context); | 195 DCHECK(av_buffer_context); |
| 194 // Either this buffer has already been released to someone else's ownership, | 196 // Either this buffer has already been released to someone else's ownership, |
| 195 // or it's the same as the buffer parameter. | 197 // or it's the same as the buffer parameter. |
| 196 DCHECK(av_buffer_context->buffer() == nullptr || | 198 DCHECK(av_buffer_context->buffer() == nullptr || |
| 197 av_buffer_context->buffer() == buffer); | 199 av_buffer_context->buffer() == buffer); |
| 198 delete av_buffer_context; | 200 delete av_buffer_context; |
| 199 } | 201 } |
| 200 | 202 |
| 201 } // namespace media | 203 } // namespace media |
| 202 } // namespace mojo | 204 } // namespace mojo |
| OLD | NEW |