diff mbox series

[FFmpeg-devel,1/2] avformat/udp: remove setting cancel state from the TX thread

Message ID 20200126212235.29546-1-cus@passwd.hu
State Accepted
Headers show
Series [FFmpeg-devel,1/2] avformat/udp: remove setting cancel state from the TX thread | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Marton Balint Jan. 26, 2020, 9:22 p.m. UTC
Write mode does not use cancellation.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/udp.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Marton Balint Feb. 1, 2020, 8:27 p.m. UTC | #1
On Sun, 26 Jan 2020, Marton Balint wrote:

> Write mode does not use cancellation.

Ping, will apply the series soon.

Thanks,
Marton

>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavformat/udp.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index dce4cf76c7..85c9e3a900 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -520,14 +520,12 @@ static void *circular_buffer_task_tx( void *_URLContext)
> {
>     URLContext *h = _URLContext;
>     UDPContext *s = h->priv_data;
> -    int old_cancelstate;
>     int64_t target_timestamp = av_gettime_relative();
>     int64_t start_timestamp = av_gettime_relative();
>     int64_t sent_bits = 0;
>     int64_t burst_interval = s->bitrate ? (s->burst_bits * 1000000 / s->bitrate) : 0;
>     int64_t max_delay = s->bitrate ?  ((int64_t)h->max_packet_size * 8 * 1000000 / s->bitrate + 1) : 0;
> 
> -    pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_cancelstate);
>     pthread_mutex_lock(&s->mutex);
>
>     if (ff_socket_nonblock(s->udp_fd, 0) < 0) {
> @@ -562,7 +560,6 @@ static void *circular_buffer_task_tx( void *_URLContext)
>         av_fifo_generic_read(s->fifo, s->tmp, len, NULL);
>
>         pthread_mutex_unlock(&s->mutex);
> -        pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old_cancelstate);
>
>         if (s->bitrate) {
>             timestamp = av_gettime_relative();
> @@ -608,7 +605,6 @@ static void *circular_buffer_task_tx( void *_URLContext)
>             }
>         }
> 
> -        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_cancelstate);
>         pthread_mutex_lock(&s->mutex);
>     }
> 
> -- 
> 2.16.4
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Marton Balint Feb. 2, 2020, 7:01 p.m. UTC | #2
On Sat, 1 Feb 2020, Marton Balint wrote:

>
>
> On Sun, 26 Jan 2020, Marton Balint wrote:
>
>> Write mode does not use cancellation.
>
> Ping, will apply the series soon.

Applied.

Regards,
Marton

>>
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>> libavformat/udp.c | 4 ----
>> 1 file changed, 4 deletions(-)
>>
>> diff --git a/libavformat/udp.c b/libavformat/udp.c
>> index dce4cf76c7..85c9e3a900 100644
>> --- a/libavformat/udp.c
>> +++ b/libavformat/udp.c
>> @@ -520,14 +520,12 @@ static void *circular_buffer_task_tx( void 
> *_URLContext)
>> {
>>     URLContext *h = _URLContext;
>>     UDPContext *s = h->priv_data;
>> -    int old_cancelstate;
>>     int64_t target_timestamp = av_gettime_relative();
>>     int64_t start_timestamp = av_gettime_relative();
>>     int64_t sent_bits = 0;
>>     int64_t burst_interval = s->bitrate ? (s->burst_bits * 1000000 / 
> s->bitrate) : 0;
>>     int64_t max_delay = s->bitrate ?  ((int64_t)h->max_packet_size * 8 * 
> 1000000 / s->bitrate + 1) : 0;
>> 
>> -    pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_cancelstate);
>>     pthread_mutex_lock(&s->mutex);
>>
>>     if (ff_socket_nonblock(s->udp_fd, 0) < 0) {
>> @@ -562,7 +560,6 @@ static void *circular_buffer_task_tx( void 
> *_URLContext)
>>         av_fifo_generic_read(s->fifo, s->tmp, len, NULL);
>>
>>         pthread_mutex_unlock(&s->mutex);
>> -        pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old_cancelstate);
>>
>>         if (s->bitrate) {
>>             timestamp = av_gettime_relative();
>> @@ -608,7 +605,6 @@ static void *circular_buffer_task_tx( void 
> *_URLContext)
>>             }
>>         }
>> 
>> -        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_cancelstate);
>>         pthread_mutex_lock(&s->mutex);
>>     }
>> 
>> -- 
>> 2.16.4
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavformat/udp.c b/libavformat/udp.c
index dce4cf76c7..85c9e3a900 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -520,14 +520,12 @@  static void *circular_buffer_task_tx( void *_URLContext)
 {
     URLContext *h = _URLContext;
     UDPContext *s = h->priv_data;
-    int old_cancelstate;
     int64_t target_timestamp = av_gettime_relative();
     int64_t start_timestamp = av_gettime_relative();
     int64_t sent_bits = 0;
     int64_t burst_interval = s->bitrate ? (s->burst_bits * 1000000 / s->bitrate) : 0;
     int64_t max_delay = s->bitrate ?  ((int64_t)h->max_packet_size * 8 * 1000000 / s->bitrate + 1) : 0;
 
-    pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_cancelstate);
     pthread_mutex_lock(&s->mutex);
 
     if (ff_socket_nonblock(s->udp_fd, 0) < 0) {
@@ -562,7 +560,6 @@  static void *circular_buffer_task_tx( void *_URLContext)
         av_fifo_generic_read(s->fifo, s->tmp, len, NULL);
 
         pthread_mutex_unlock(&s->mutex);
-        pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old_cancelstate);
 
         if (s->bitrate) {
             timestamp = av_gettime_relative();
@@ -608,7 +605,6 @@  static void *circular_buffer_task_tx( void *_URLContext)
             }
         }
 
-        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_cancelstate);
         pthread_mutex_lock(&s->mutex);
     }