OLD | NEW |
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 "media/filters/ffmpeg_demuxer.h" | 5 #include "media/filters/ffmpeg_demuxer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 130 } |
131 | 131 |
132 if ((type() == DemuxerStream::AUDIO && audio_config_.is_encrypted()) || | 132 if ((type() == DemuxerStream::AUDIO && audio_config_.is_encrypted()) || |
133 (type() == DemuxerStream::VIDEO && video_config_.is_encrypted())) { | 133 (type() == DemuxerStream::VIDEO && video_config_.is_encrypted())) { |
134 scoped_ptr<DecryptConfig> config(WebMCreateDecryptConfig( | 134 scoped_ptr<DecryptConfig> config(WebMCreateDecryptConfig( |
135 packet->data, packet->size, | 135 packet->data, packet->size, |
136 reinterpret_cast<const uint8*>(encryption_key_id_.data()), | 136 reinterpret_cast<const uint8*>(encryption_key_id_.data()), |
137 encryption_key_id_.size())); | 137 encryption_key_id_.size())); |
138 if (!config) | 138 if (!config) |
139 LOG(ERROR) << "Creation of DecryptConfig failed."; | 139 LOG(ERROR) << "Creation of DecryptConfig failed."; |
140 buffer->SetDecryptConfig(config.Pass()); | 140 buffer->set_decrypt_config(config.Pass()); |
141 } | 141 } |
142 | 142 |
143 buffer->SetTimestamp(ConvertStreamTimestamp( | 143 buffer->set_timestamp(ConvertStreamTimestamp( |
144 stream_->time_base, packet->pts)); | 144 stream_->time_base, packet->pts)); |
145 buffer->SetDuration(ConvertStreamTimestamp( | 145 buffer->set_duration(ConvertStreamTimestamp( |
146 stream_->time_base, packet->duration)); | 146 stream_->time_base, packet->duration)); |
147 if (buffer->GetTimestamp() != kNoTimestamp() && | 147 if (buffer->timestamp() != kNoTimestamp() && |
148 last_packet_timestamp_ != kNoTimestamp() && | 148 last_packet_timestamp_ != kNoTimestamp() && |
149 last_packet_timestamp_ < buffer->GetTimestamp()) { | 149 last_packet_timestamp_ < buffer->timestamp()) { |
150 buffered_ranges_.Add(last_packet_timestamp_, buffer->GetTimestamp()); | 150 buffered_ranges_.Add(last_packet_timestamp_, buffer->timestamp()); |
151 demuxer_->NotifyBufferingChanged(); | 151 demuxer_->NotifyBufferingChanged(); |
152 } | 152 } |
153 last_packet_timestamp_ = buffer->GetTimestamp(); | 153 last_packet_timestamp_ = buffer->timestamp(); |
154 | 154 |
155 buffer_queue_.Push(buffer); | 155 buffer_queue_.Push(buffer); |
156 SatisfyPendingRead(); | 156 SatisfyPendingRead(); |
157 } | 157 } |
158 | 158 |
159 void FFmpegDemuxerStream::SetEndOfStream() { | 159 void FFmpegDemuxerStream::SetEndOfStream() { |
160 DCHECK(message_loop_->BelongsToCurrentThread()); | 160 DCHECK(message_loop_->BelongsToCurrentThread()); |
161 end_of_stream_ = true; | 161 end_of_stream_ = true; |
162 SatisfyPendingRead(); | 162 SatisfyPendingRead(); |
163 } | 163 } |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 } | 774 } |
775 for (size_t i = 0; i < buffered.size(); ++i) | 775 for (size_t i = 0; i < buffered.size(); ++i) |
776 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); | 776 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); |
777 } | 777 } |
778 | 778 |
779 void FFmpegDemuxer::OnDataSourceError() { | 779 void FFmpegDemuxer::OnDataSourceError() { |
780 host_->OnDemuxerError(PIPELINE_ERROR_READ); | 780 host_->OnDemuxerError(PIPELINE_ERROR_READ); |
781 } | 781 } |
782 | 782 |
783 } // namespace media | 783 } // namespace media |
OLD | NEW |