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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 if (packet->stream_index >= 0 && | 895 if (packet->stream_index >= 0 && |
896 packet->stream_index < static_cast<int>(streams_.size()) && | 896 packet->stream_index < static_cast<int>(streams_.size()) && |
897 streams_[packet->stream_index]) { | 897 streams_[packet->stream_index]) { |
898 // TODO(scherkus): Fix demuxing upstream to never return packets w/o data | 898 // TODO(scherkus): Fix demuxing upstream to never return packets w/o data |
899 // when av_read_frame() returns success code. See bug comment for ideas: | 899 // when av_read_frame() returns success code. See bug comment for ideas: |
900 // | 900 // |
901 // https://code.google.com/p/chromium/issues/detail?id=169133#c10 | 901 // https://code.google.com/p/chromium/issues/detail?id=169133#c10 |
902 if (!packet->data) { | 902 if (!packet->data) { |
903 ScopedAVPacket new_packet(new AVPacket()); | 903 ScopedAVPacket new_packet(new AVPacket()); |
904 av_new_packet(new_packet.get(), 0); | 904 av_new_packet(new_packet.get(), 0); |
905 | 905 av_packet_copy_props(new_packet.get(), packet.get()); |
906 new_packet->pts = packet->pts; | |
907 new_packet->dts = packet->dts; | |
908 new_packet->pos = packet->pos; | |
909 new_packet->duration = packet->duration; | |
910 new_packet->convergence_duration = packet->convergence_duration; | |
911 new_packet->flags = packet->flags; | |
912 new_packet->stream_index = packet->stream_index; | |
913 | |
914 packet.swap(new_packet); | 906 packet.swap(new_packet); |
915 } | 907 } |
916 | 908 |
917 // Special case for opus in ogg. FFmpeg is pre-trimming the codec delay | 909 // Special case for opus in ogg. FFmpeg is pre-trimming the codec delay |
918 // from the packet timestamp. Chrome expects to handle this itself inside | 910 // from the packet timestamp. Chrome expects to handle this itself inside |
919 // the decoder, so shift timestamps by the delay in this case. | 911 // the decoder, so shift timestamps by the delay in this case. |
920 // TODO(dalecurtis): Try to get fixed upstream. See http://crbug.com/328207 | 912 // TODO(dalecurtis): Try to get fixed upstream. See http://crbug.com/328207 |
921 if (strcmp(glue_->format_context()->iformat->name, "ogg") == 0) { | 913 if (strcmp(glue_->format_context()->iformat->name, "ogg") == 0) { |
922 const AVCodecContext* codec_context = | 914 const AVCodecContext* codec_context = |
923 glue_->format_context()->streams[packet->stream_index]->codec; | 915 glue_->format_context()->streams[packet->stream_index]->codec; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 } | 1012 } |
1021 for (size_t i = 0; i < buffered.size(); ++i) | 1013 for (size_t i = 0; i < buffered.size(); ++i) |
1022 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); | 1014 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); |
1023 } | 1015 } |
1024 | 1016 |
1025 void FFmpegDemuxer::OnDataSourceError() { | 1017 void FFmpegDemuxer::OnDataSourceError() { |
1026 host_->OnDemuxerError(PIPELINE_ERROR_READ); | 1018 host_->OnDemuxerError(PIPELINE_ERROR_READ); |
1027 } | 1019 } |
1028 | 1020 |
1029 } // namespace media | 1021 } // namespace media |
OLD | NEW |