summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
37cb86f)
Change-Id: Iac08af5804aa15c1b65f3122028392ace2b89e64
static gboolean
gst_aac_parse_estimate_duration (GstBaseParse * parse)
{
static gboolean
gst_aac_parse_estimate_duration (GstBaseParse * parse)
{
GstFlowReturn res = GST_FLOW_OK;
gint64 pull_size = 0, file_size = 0, offset = 0, num_frames=0, duration=0;
guint profile = 0, sample_rate_index = 0, sample_rate = 0, channel = 0;
GstFlowReturn res = GST_FLOW_OK;
gint64 pull_size = 0, file_size = 0, offset = 0, num_frames=0, duration=0;
guint profile = 0, sample_rate_index = 0, sample_rate = 0, channel = 0;
gst_buffer_map(buffer, &map, GST_MAP_READ);
buf = map.data;
buffer_size = map.size;
gst_buffer_map(buffer, &map, GST_MAP_READ);
buf = map.data;
buffer_size = map.size;
- if(buffer_size != pull_size)
- {
+ if (buffer_size != pull_size) {
GST_ERROR_OBJECT(aacparse, "We got different buffer_size(%d) with pull_size(%d).",
buffer_size, pull_size);
}
GST_ERROR_OBJECT(aacparse, "We got different buffer_size(%d) with pull_size(%d).",
buffer_size, pull_size);
}
sample_rate_index = (buf[i+2] >> 2) & 0xf;
sample_rate = gst_aac_parse_get_sample_rate_from_index(sample_rate_index);
if (sample_rate == 0) {
sample_rate_index = (buf[i+2] >> 2) & 0xf;
sample_rate = gst_aac_parse_get_sample_rate_from_index(sample_rate_index);
if (sample_rate == 0) {
- gst_buffer_unmap(buffer, &map);
GST_WARNING_OBJECT (aacparse, "Invalid sample rate index (0)");
GST_WARNING_OBJECT (aacparse, "Invalid sample rate index (0)");
}
channel = (buf[i+2] & 0x1) << 2 | (buf[i+3] >> 6);
}
channel = (buf[i+2] & 0x1) << 2 | (buf[i+3] >> 6);
} else if (frame_size == -1) {
offset++;
lost_sync_count++; // lost sync count limmitation 2K Bytes
} else if (frame_size == -1) {
offset++;
lost_sync_count++; // lost sync count limmitation 2K Bytes
- if (lost_sync_count > (1024*2))
- {
- gst_buffer_unmap(buffer, &map);
- return FALSE;
+ if (lost_sync_count > (1024*2)) {
+ GST_WARNING_OBJECT (aacparse, "lost_sync_count is larger than 2048");
+ goto EXIT;
}
} else {
offset += frame_size;
}
} else {
offset += frame_size;
frame_duration_us = (1024 * 1000000ll + (sample_rate - 1)) / sample_rate;
duration = num_frames * frame_duration_us;
frame_duration_us = (1024 * 1000000ll + (sample_rate - 1)) / sample_rate;
duration = num_frames * frame_duration_us;
+ if (duration == 0) {
+ GST_WARNING_OBJECT (aacparse, "Invalid duration");
+ goto EXIT;
+ }
estimated_bitrate = (gint)((gfloat)(offset * 8) / (gfloat)(duration / 1000));
estimated_bitrate = (gint)((gfloat)(offset * 8) / (gfloat)(duration / 1000));
+
+ if (estimated_bitrate == 0) {
+ GST_WARNING_OBJECT (aacparse, "Invalid estimated_bitrate");
+ goto EXIT;
+ }
estimated_duration = (GstClockTime)((file_size * 8) / (estimated_bitrate * 1000)) * GST_SECOND;
GST_INFO_OBJECT (aacparse, "number of frame = %"G_GINT64_FORMAT, num_frames);
estimated_duration = (GstClockTime)((file_size * 8) / (estimated_bitrate * 1000)) * GST_SECOND;
GST_INFO_OBJECT (aacparse, "number of frame = %"G_GINT64_FORMAT, num_frames);
gst_buffer_unmap(buffer, &map);
gst_buffer_unmap(buffer, &map);
- gst_buffer_unref (buffer);
- return TRUE;
+ gst_buffer_unref(buffer);
+ return ret;
Name: gst-plugins-good
Version: 1.6.1
Name: gst-plugins-good
Version: 1.6.1
License: LGPL-2.1+
Summary: GStreamer Streaming-Media Framework Plug-Ins
Url: http://gstreamer.freedesktop.org/
License: LGPL-2.1+
Summary: GStreamer Streaming-Media Framework Plug-Ins
Url: http://gstreamer.freedesktop.org/