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 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 std::string title = stream->GetMetadata("title"); | 910 std::string title = stream->GetMetadata("title"); |
911 std::string language = stream->GetMetadata("language"); | 911 std::string language = stream->GetMetadata("language"); |
912 | 912 |
913 // TODO: Implement "id" metadata in FFMPEG. | 913 // TODO: Implement "id" metadata in FFMPEG. |
914 // See: http://crbug.com/323183 | 914 // See: http://crbug.com/323183 |
915 host_->AddTextStream(stream, TextTrackConfig(kind, title, language, | 915 host_->AddTextStream(stream, TextTrackConfig(kind, title, language, |
916 std::string())); | 916 std::string())); |
917 } | 917 } |
918 } | 918 } |
919 | 919 |
| 920 int64_t FFmpegDemuxer::GetMemoryUsage() const { |
| 921 int64_t allocation_size = 0; |
| 922 for (const auto& stream : streams_) |
| 923 allocation_size += stream->MemoryUsage(); |
| 924 return allocation_size; |
| 925 } |
| 926 |
920 // Helper for calculating the bitrate of the media based on information stored | 927 // Helper for calculating the bitrate of the media based on information stored |
921 // in |format_context| or failing that the size and duration of the media. | 928 // in |format_context| or failing that the size and duration of the media. |
922 // | 929 // |
923 // Returns 0 if a bitrate could not be determined. | 930 // Returns 0 if a bitrate could not be determined. |
924 static int CalculateBitrate( | 931 static int CalculateBitrate( |
925 AVFormatContext* format_context, | 932 AVFormatContext* format_context, |
926 const base::TimeDelta& duration, | 933 const base::TimeDelta& duration, |
927 int64 filesize_in_bytes) { | 934 int64 filesize_in_bytes) { |
928 // If there is a bitrate set on the container, use it. | 935 // If there is a bitrate set on the container, use it. |
929 if (format_context->bit_rate > 0) | 936 if (format_context->bit_rate > 0) |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 | 1510 |
1504 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { | 1511 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { |
1505 DCHECK(task_runner_->BelongsToCurrentThread()); | 1512 DCHECK(task_runner_->BelongsToCurrentThread()); |
1506 for (const auto& stream : streams_) { // |stream| is a ref to a pointer. | 1513 for (const auto& stream : streams_) { // |stream| is a ref to a pointer. |
1507 if (stream) | 1514 if (stream) |
1508 stream->SetLiveness(liveness); | 1515 stream->SetLiveness(liveness); |
1509 } | 1516 } |
1510 } | 1517 } |
1511 | 1518 |
1512 } // namespace media | 1519 } // namespace media |
OLD | NEW |