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_decoder_base.h" | 6 #include "services/media/framework_ffmpeg/ffmpeg_decoder_base.h" |
7 #include "services/media/framework_ffmpeg/ffmpeg_type_converters.h" | 7 #include "services/media/framework_ffmpeg/ffmpeg_type_converters.h" |
8 | 8 |
9 namespace mojo { | 9 namespace mojo { |
10 namespace media { | 10 namespace media { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 // Used up the whole input packet, and, if we were draining, we're done with | 70 // Used up the whole input packet, and, if we were draining, we're done with |
71 // that too. | 71 // that too. |
72 return UnprepareInputPacket(input, output); | 72 return UnprepareInputPacket(input, output); |
73 } | 73 } |
74 | 74 |
75 void FfmpegDecoderBase::PrepareInputPacket(const PacketPtr& input) { | 75 void FfmpegDecoderBase::PrepareInputPacket(const PacketPtr& input) { |
76 av_init_packet(&av_packet_); | 76 av_init_packet(&av_packet_); |
77 av_packet_.data = reinterpret_cast<uint8_t*>(input->payload()); | 77 av_packet_.data = reinterpret_cast<uint8_t*>(input->payload()); |
78 av_packet_.size = input->size(); | 78 av_packet_.size = input->size(); |
79 av_packet_.pts = input->presentation_time(); | 79 av_packet_.pts = input->pts(); |
80 } | 80 } |
81 | 81 |
82 bool FfmpegDecoderBase::UnprepareInputPacket( | 82 bool FfmpegDecoderBase::UnprepareInputPacket( |
83 const PacketPtr& input, | 83 const PacketPtr& input, |
84 PacketPtr* output) { | 84 PacketPtr* output) { |
85 if (input->end_of_stream()) { | 85 if (input->end_of_stream()) { |
86 // Indicate end of stream. This happens when we're draining for the last | 86 // Indicate end of stream. This happens when we're draining for the last |
87 // time, so there should be no output packet yet. | 87 // time, so there should be no output packet yet. |
88 DCHECK(*output == nullptr); | 88 DCHECK(*output == nullptr); |
89 *output = CreateOutputEndOfStreamPacket(); | 89 *output = CreateOutputEndOfStreamPacket(); |
90 } | 90 } |
91 | 91 |
92 av_packet_.size = 0; | 92 av_packet_.size = 0; |
93 av_packet_.data = nullptr; | 93 av_packet_.data = nullptr; |
94 | 94 |
95 return true; | 95 return true; |
96 } | 96 } |
97 | 97 |
98 } // namespace media | 98 } // namespace media |
99 } // namespace mojo | 99 } // namespace mojo |
OLD | NEW |