| 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     if (stream) | 
|  | 924       allocation_size += stream->MemoryUsage(); | 
|  | 925   } | 
|  | 926   return allocation_size; | 
|  | 927 } | 
|  | 928 | 
| 920 // Helper for calculating the bitrate of the media based on information stored | 929 // 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. | 930 // in |format_context| or failing that the size and duration of the media. | 
| 922 // | 931 // | 
| 923 // Returns 0 if a bitrate could not be determined. | 932 // Returns 0 if a bitrate could not be determined. | 
| 924 static int CalculateBitrate( | 933 static int CalculateBitrate( | 
| 925     AVFormatContext* format_context, | 934     AVFormatContext* format_context, | 
| 926     const base::TimeDelta& duration, | 935     const base::TimeDelta& duration, | 
| 927     int64 filesize_in_bytes) { | 936     int64 filesize_in_bytes) { | 
| 928   // If there is a bitrate set on the container, use it. | 937   // If there is a bitrate set on the container, use it. | 
| 929   if (format_context->bit_rate > 0) | 938   if (format_context->bit_rate > 0) | 
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1503 | 1512 | 
| 1504 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { | 1513 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { | 
| 1505   DCHECK(task_runner_->BelongsToCurrentThread()); | 1514   DCHECK(task_runner_->BelongsToCurrentThread()); | 
| 1506   for (const auto& stream : streams_) {  // |stream| is a ref to a pointer. | 1515   for (const auto& stream : streams_) {  // |stream| is a ref to a pointer. | 
| 1507     if (stream) | 1516     if (stream) | 
| 1508       stream->SetLiveness(liveness); | 1517       stream->SetLiveness(liveness); | 
| 1509   } | 1518   } | 
| 1510 } | 1519 } | 
| 1511 | 1520 | 
| 1512 }  // namespace media | 1521 }  // namespace media | 
| OLD | NEW | 
|---|