| 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 <condition_variable> | 5 #include <condition_variable> |
| 6 #include <map> | 6 #include <map> |
| 7 #include <mutex> | 7 #include <mutex> |
| 8 #include <thread> | 8 #include <thread> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 if (av_read_frame(format_context_.get(), av_packet.get()) < 0) { | 289 if (av_read_frame(format_context_.get(), av_packet.get()) < 0) { |
| 290 // End of stream. Start producing end-of-stream packets for all the streams. | 290 // End of stream. Start producing end-of-stream packets for all the streams. |
| 291 next_stream_to_end_ = 0; | 291 next_stream_to_end_ = 0; |
| 292 return PullEndOfStreamPacket(stream_index_out); | 292 return PullEndOfStreamPacket(stream_index_out); |
| 293 } | 293 } |
| 294 | 294 |
| 295 *stream_index_out = static_cast<size_t>(av_packet->stream_index); | 295 *stream_index_out = static_cast<size_t>(av_packet->stream_index); |
| 296 // TODO(dalesat): What if the packet has no PTS or duration? | 296 // TODO(dalesat): What if the packet has no PTS or duration? |
| 297 next_pts_ = av_packet->pts + av_packet->duration; | 297 next_pts_ = av_packet->pts + av_packet->duration; |
| 298 // TODO(dalesat): Implement packet side data. |
| 299 DCHECK(av_packet->side_data == nullptr) << "side data not implemented"; |
| 300 DCHECK(av_packet->side_data_elems == 0); |
| 298 | 301 |
| 299 return DemuxPacket::Create(std::move(av_packet)); | 302 return DemuxPacket::Create(std::move(av_packet)); |
| 300 } | 303 } |
| 301 | 304 |
| 302 PacketPtr FfmpegDemuxImpl::PullEndOfStreamPacket(size_t* stream_index_out) { | 305 PacketPtr FfmpegDemuxImpl::PullEndOfStreamPacket(size_t* stream_index_out) { |
| 303 DCHECK(next_stream_to_end_ >= 0); | 306 DCHECK(next_stream_to_end_ >= 0); |
| 304 | 307 |
| 305 if (static_cast<std::size_t>(next_stream_to_end_) >= streams_.size()) { | 308 if (static_cast<std::size_t>(next_stream_to_end_) >= streams_.size()) { |
| 306 NOTREACHED() << "PullPacket called after all streams have ended"; | 309 NOTREACHED() << "PullPacket called after all streams have ended"; |
| 307 return nullptr; | 310 return nullptr; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 return index_; | 343 return index_; |
| 341 } | 344 } |
| 342 | 345 |
| 343 std::unique_ptr<StreamType> FfmpegDemuxImpl::FfmpegDemuxStream::stream_type() | 346 std::unique_ptr<StreamType> FfmpegDemuxImpl::FfmpegDemuxStream::stream_type() |
| 344 const { | 347 const { |
| 345 return SafeClone(stream_type_); | 348 return SafeClone(stream_type_); |
| 346 } | 349 } |
| 347 | 350 |
| 348 } // namespace media | 351 } // namespace media |
| 349 } // namespace mojo | 352 } // namespace mojo |
| OLD | NEW |