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

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

Issue 111153003: FFmpeg fixups for M33 roll. Now with more Opus! (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DEPS update. Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « DEPS ('k') | media/cdm/ppapi/ffmpeg_cdm_audio_decoder.cc » ('j') | no next file with comments »
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 if (codec && avcodec_open2(c, codec, NULL) >= 0) 53 if (codec && avcodec_open2(c, codec, NULL) >= 0)
54 stream_contexts[i] = c; 54 stream_contexts[i] = c;
55 } 55 }
56 } 56 }
57 57
58 if (stream_contexts.size() == 0) 58 if (stream_contexts.size() == 0)
59 return false; 59 return false;
60 60
61 AVPacket packet; 61 AVPacket packet;
62 scoped_ptr_malloc<AVFrame, media::ScopedPtrAVFreeFrame> frame( 62 scoped_ptr_malloc<AVFrame, media::ScopedPtrAVFreeFrame> frame(
63 avcodec_alloc_frame()); 63 av_frame_alloc());
64 int result = 0; 64 int result = 0;
65 65
66 base::Time deadline = base::Time::Now() + 66 base::Time deadline = base::Time::Now() +
67 std::min(check_time, 67 std::min(check_time,
68 base::TimeDelta::FromSeconds(kMaxCheckTimeInSeconds)); 68 base::TimeDelta::FromSeconds(kMaxCheckTimeInSeconds));
69 do { 69 do {
70 result = av_read_frame(glue.format_context(), &packet); 70 result = av_read_frame(glue.format_context(), &packet);
71 if (result < 0) 71 if (result < 0)
72 break; 72 break;
73 result = av_dup_packet(&packet); 73 result = av_dup_packet(&packet);
(...skipping 27 matching lines...) Expand all
101 result = avcodec_decode_video2(av_context, frame.get(), &frame_decoded, 101 result = avcodec_decode_video2(av_context, frame.get(), &frame_decoded,
102 &packet); 102 &packet);
103 } 103 }
104 av_free_packet(&packet); 104 av_free_packet(&packet);
105 } while (base::Time::Now() < deadline && read_ok && result >= 0); 105 } while (base::Time::Now() < deadline && read_ok && result >= 0);
106 106
107 return read_ok && (result == AVERROR_EOF || result >= 0); 107 return read_ok && (result == AVERROR_EOF || result >= 0);
108 } 108 }
109 109
110 } // namespace media 110 } // namespace media
OLDNEW
« no previous file with comments | « DEPS ('k') | media/cdm/ppapi/ffmpeg_cdm_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698