[0.6.72] Add checking duration when video bitrate update 69/155469/1
authorGilbok Lee <gilbok.lee@samsung.com>
Fri, 13 Oct 2017 07:39:17 +0000 (16:39 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Fri, 13 Oct 2017 07:39:17 +0000 (16:39 +0900)
Change-Id: I06fd729b1a1194a071fb5f45c76606c36aa09ae7

packaging/libmm-player.spec
src/mm_player_priv.c

index 5d8cfa9..29d5cf3 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.71
+Version:    0.6.72
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index af906a6..57b1a03 100644 (file)
@@ -473,8 +473,9 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag)
 
                                if (stat(path, &sb) == 0)
                                        data_size = (guint64)sb.st_size;
-                       } else if (MMPLAYER_IS_HTTP_STREAMING(player))
+                       } else if (MMPLAYER_IS_HTTP_STREAMING(player)) {
                                data_size = player->http_content_size;
+                       }
                        LOGD("try to update bitrate : data_size = %lld", data_size);
 
                        if (data_size) {
@@ -482,11 +483,15 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag)
                                guint64 msec_dur = 0;
 
                                msec_dur = GST_TIME_AS_MSECONDS(player->duration);
-                               bitrate = data_size * 8 * 1000 / msec_dur;
-                               SECURE_LOGD("file size : %u, video bitrate = %llu", data_size, bitrate);
-                               mm_attrs_set_int_by_name(attrs, "content_video_bitrate", bitrate);
+                               if (msec_dur > 0) {
+                                       bitrate = data_size * 8 * 1000 / msec_dur;
+                                       SECURE_LOGD("file size : %u, video bitrate = %llu", data_size, bitrate);
+                                       mm_attrs_set_int_by_name(attrs, "content_video_bitrate", bitrate);
 
-                               has_bitrate = TRUE;
+                                       has_bitrate = TRUE;
+                               } else {
+                                       LOGD("player duration is less than 0");
+                               }
                        }
 
                        if (MMPLAYER_IS_RTSP_STREAMING(player)) {