Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: media/base/media_file_checker.cc

Issue 286953005: Roll FFmpeg for M37. (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/cast/test/sender.cc » ('j') | media/cast/test/sender.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/base/media_file_checker.h" 5 #include "media/base/media_file_checker.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 result = av_dup_packet(&packet); 69 result = av_dup_packet(&packet);
70 if (result < 0) 70 if (result < 0)
71 break; 71 break;
72 72
73 std::map<int, AVCodecContext*>::const_iterator it = 73 std::map<int, AVCodecContext*>::const_iterator it =
74 stream_contexts.find(packet.stream_index); 74 stream_contexts.find(packet.stream_index);
75 if (it == stream_contexts.end()) { 75 if (it == stream_contexts.end()) {
76 av_free_packet(&packet); 76 av_free_packet(&packet);
77 continue; 77 continue;
78 } 78 }
79 AVCodecContext* av_context = it->second; 79 AVCodecContext* av_context = it->second;
wolenetz 2014/05/16 19:45:58 I'm confused a bit. Codesearch failed to indicate
DaleCurtis 2014/05/16 19:54:26 Looks like this may need to wait until the roll af
80 80
81 int frame_decoded = 0; 81 int frame_decoded = 0;
82 if (av_context->codec_type == AVMEDIA_TYPE_AUDIO) { 82 if (av_context->codec_type == AVMEDIA_TYPE_AUDIO) {
83 // A shallow copy of packet so we can slide packet.data as frames are 83 // A shallow copy of packet so we can slide packet.data as frames are
84 // decoded; otherwise av_free_packet() will corrupt memory. 84 // decoded; otherwise av_free_packet() will corrupt memory.
85 AVPacket temp_packet = packet; 85 AVPacket temp_packet = packet;
86 do { 86 do {
87 avcodec_get_frame_defaults(frame.get());
wolenetz 2014/05/16 19:45:58 nit: In CL description, s/get_buffer_defaults/get_
DaleCurtis 2014/05/20 01:13:45 Done.
88 result = avcodec_decode_audio4(av_context, frame.get(), &frame_decoded, 87 result = avcodec_decode_audio4(av_context, frame.get(), &frame_decoded,
89 &temp_packet); 88 &temp_packet);
90 if (result < 0) 89 if (result < 0)
91 break; 90 break;
91 av_frame_unref(frame.get());
92 temp_packet.size -= result; 92 temp_packet.size -= result;
93 temp_packet.data += result; 93 temp_packet.data += result;
94 frame_decoded = 0;
94 } while (temp_packet.size > 0); 95 } while (temp_packet.size > 0);
95 } else if (av_context->codec_type == AVMEDIA_TYPE_VIDEO) { 96 } else if (av_context->codec_type == AVMEDIA_TYPE_VIDEO) {
96 avcodec_get_frame_defaults(frame.get());
97 result = avcodec_decode_video2(av_context, frame.get(), &frame_decoded, 97 result = avcodec_decode_video2(av_context, frame.get(), &frame_decoded,
wolenetz 2014/05/16 19:45:58 (Possibly for a different CL): Per https://code.go
DaleCurtis 2014/05/16 19:54:26 DecoderBuffer automatically pads and zeros.
wolenetz 2014/05/20 22:37:10 (Clarification from offline / CR reply comment in
98 &packet); 98 &packet);
99 if (result >= 0 && frame_decoded)
wolenetz 2014/05/16 19:45:58 (Possibly for a different CL): Per https://code.go
DaleCurtis 2014/05/16 19:54:26 Hmm, that comment has changed I think. When I talk
DaleCurtis 2014/05/20 01:13:45 Done.
wolenetz 2014/05/20 22:37:10 Clarification from offline: DCHECK is added to mai
100 av_frame_unref(frame.get());
99 } 101 }
100 av_free_packet(&packet); 102 av_free_packet(&packet);
101 } while (base::TimeTicks::Now() < deadline && read_ok && result >= 0); 103 } while (base::TimeTicks::Now() < deadline && read_ok && result >= 0);
102 104
103 return read_ok && (result == AVERROR_EOF || result >= 0); 105 return read_ok && (result == AVERROR_EOF || result >= 0);
104 } 106 }
105 107
106 } // namespace media 108 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/cast/test/sender.cc » ('j') | media/cast/test/sender.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698