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

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

Issue 134603005: Clean-up: Remove the very last few uses of base::Time from src/media/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
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 } 53 }
54 54
55 if (stream_contexts.size() == 0) 55 if (stream_contexts.size() == 0)
56 return false; 56 return false;
57 57
58 AVPacket packet; 58 AVPacket packet;
59 scoped_ptr_malloc<AVFrame, media::ScopedPtrAVFreeFrame> frame( 59 scoped_ptr_malloc<AVFrame, media::ScopedPtrAVFreeFrame> frame(
60 av_frame_alloc()); 60 av_frame_alloc());
61 int result = 0; 61 int result = 0;
62 62
63 base::Time deadline = base::Time::Now() + 63 const base::TimeTicks deadline = base::TimeTicks::Now() +
64 std::min(check_time, 64 std::min(check_time,
65 base::TimeDelta::FromSeconds(kMaxCheckTimeInSeconds)); 65 base::TimeDelta::FromSeconds(kMaxCheckTimeInSeconds));
66 do { 66 do {
67 result = av_read_frame(glue.format_context(), &packet); 67 result = av_read_frame(glue.format_context(), &packet);
68 if (result < 0) 68 if (result < 0)
69 break; 69 break;
70 result = av_dup_packet(&packet); 70 result = av_dup_packet(&packet);
71 if (result < 0) 71 if (result < 0)
72 break; 72 break;
73 73
(...skipping 18 matching lines...) Expand all
92 break; 92 break;
93 temp_packet.size -= result; 93 temp_packet.size -= result;
94 temp_packet.data += result; 94 temp_packet.data += result;
95 } while (temp_packet.size > 0); 95 } while (temp_packet.size > 0);
96 } else if (av_context->codec_type == AVMEDIA_TYPE_VIDEO) { 96 } else if (av_context->codec_type == AVMEDIA_TYPE_VIDEO) {
97 avcodec_get_frame_defaults(frame.get()); 97 avcodec_get_frame_defaults(frame.get());
98 result = avcodec_decode_video2(av_context, frame.get(), &frame_decoded, 98 result = avcodec_decode_video2(av_context, frame.get(), &frame_decoded,
99 &packet); 99 &packet);
100 } 100 }
101 av_free_packet(&packet); 101 av_free_packet(&packet);
102 } while (base::Time::Now() < deadline && read_ok && result >= 0); 102 } while (base::TimeTicks::Now() < deadline && read_ok && result >= 0);
103 103
104 return read_ok && (result == AVERROR_EOF || result >= 0); 104 return read_ok && (result == AVERROR_EOF || result >= 0);
105 } 105 }
106 106
107 } // namespace media 107 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698